public static long cacheSize(final long epoch) {
    long size = epoch * CACHE_GROWTH_BYTES + CACHE_INIT_BYTES - HASH_BYTES;
    while (!isPrime(Long.divideUnsigned(size, HASH_BYTES))) {
      size -= 2 * HASH_BYTES;
    }
    return size;
  }
Calculates EthHash Cache size at a given epoch.

@param epoch EthHash Epoch
@return Cache size
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/EthHash.java