A113878 a(1)=0; a(n+1) is the least number > a(n) such that Sum_{k=1..n+1} 2^a(k) is not composite.
0, 1, 2, 4, 7, 16, 53, 66, 207, 1752, 5041, 6310
Offset: 1
Programs
-
Mathematica
a[1] = 0; a[n_] := a[n] = Block[{k = a[n - 1] + 1, s = Plus @@ (2^Array[a, n - 1])}, While[ !PrimeQ[s + 2^k], k++ ]; k]; Array[a, 12] (* Robert G. Wilson v *)
-
Python
from sympy import isprime def afind(limit): print("0, 1", end=", ") s, pow2 = 2**0 + 2**1, 2**2 for m in range(2, limit+1): if isprime(s+pow2): print(m, end=", "); s += pow2 pow2 *= 2 afind(2000) # Michael S. Branicky, Jul 11 2021
Extensions
Edited by Don Reble, Feb 17 2006
Comments