My program was only able to check primes up to 31. I got an overflow error for p=37.
Of those tested, only 2 and 5 showed divisibility by p.
3^(2^2+2+1) + 7^(2^2+2+1) = 825730 YES
3^(3^2+3+1) + 7^(3^2+3+1) = 96890604730 NOT
3^(5^2+5+1) + 7^(5^2+5+1) = 157775382035463480011326690 YES
3^(7^2+7+1) + 7^(7^2+7+1) = 1481113296616977741465675575412832815642061889770 NOT
3^(11^2+11+1) + 7^(11^2+11+1) ==
25005717582450259773164625242025584896575919345223570965796451489297591182424743143233270148751463001601008075930 NOT
---------
import sympy
def isprime(n):
return sympy.isprime(n)
primes = [i for i in range(1000) if isprime(i)]
def f(p):
return (3**(p**2+p+1) + 7**(p**2+p+1)) % p == 0
for p in primes:
if f(p):
try:
print(p, 3**(p**2+p+1) + 7**(p**2+p+1), (3**(p**2+p+1) + 7**(p**2+p+1))/p)
except:
print(p)
break
|
Posted by Larry
on 2024-10-15 11:14:32 |