func SumOfPrimes(below uint64) uint64 { out := common.PrimeSieveOfEratV1(below) var sum uint64 for n := range out { sum += n } return sum }
func NumberOfCircularPrimes(below uint64) uint64 { out := common.PrimeSieveOfEratV1(below) count := uint64(0) for p := range out { if common.IsCircularPrime(p) { count++ } } return count }
func NthPrime(n uint64) uint64 { _, below := common.RangeOfNthPrime(n) if n < 10 { below = n * n } out := common.PrimeSieveOfEratV1(below) var nth_prime, count uint64 for p := range out { count++ if count == n { nth_prime = p } } return nth_prime }
func ConsecutivePrimeSum(below uint64) uint64 { pchan := common.PrimeSieveOfEratV1(below) primes := make([]uint64, 0, common.NumberOfPrimes(below)) for p := range pchan { primes = append(primes, p) } var sum, count, fsum, fcount uint64 for i, _ := range primes { sum, count = 0, 0 for _, cp := range primes[i:] { sum += cp if sum >= below { break } if common.IsPrime(sum) && count > fcount { fcount = count fsum = sum } count++ } } return fsum }