Beispiel #1
0
def leftTrunc(n):
    if str(n)[1:] == '':
        return ansr
    else:
        if ef.isPrime(n):
            if ef.isPrime(int(str(n)[1:])):
                ansr.append(True)
                return leftTrunc(int(str(n)[1:]))
            else:
                ansr.append(False)
                return [0]
        else:
            return [0]
Beispiel #2
0
def rightTrunc(n):
    if str(n)[1:] == '':
        return ansl
    else:
        if ef.isPrime(n):
            if ef.isPrime(int(str(n)[:-1])):
                ansl.append(True)
                return rightTrunc(int(str(n)[:-1]))
            else:
                ansl.append(False)
                return [0]
        else:
            return [0]
Beispiel #3
0
def compute():
    ans = [2, 3]
    a = 5
    while a <= 2000000:
        if ef.isPrime(a):
            ans.append(a)
            a += 2
            # print((ans))
        else:
            a += 2

    return sum(ans)
Beispiel #4
0
def compute():
    ans = [2, 3]
    a = 5
    while len(ans) <= 10000:
        if ef.isPrime(a):
            ans.append(a)
            a += 2
            # print((ans))
        else:
            a += 2

    return max(ans)
Beispiel #5
0
#!/usr/bin/env python

from eulerfuncs import isPrime

if __name__ == '__main__':
  primes = [2]
  n = 3
  while len(primes) < 10001:
    if isPrime(n):
      primes.append(n)
    n += 2
  print(primes[10000])
Beispiel #6
0
def countPrimes(a, b):
  for n in count(0):
    if not isPrime(n**2 + a*n + b):
      return n