A057856 Least k such that (n+1)^k + n^k is a prime.
1, 1, 1, 2, 1, 1, 2, 1, 1, 32, 1, 2, 4, 1, 1, 4, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 4
Offset: 1
Examples
a(101)=16 because 101^16 + 102^16 = 254536435001431070450581794495937.
Programs
-
Mathematica
Table[ k = 0; While[ !PrimeQ[ (n + 1)^(2^k) + n^(2^k) ], k++ ]; 2^k, {n, 1, 27} ]
-
PARI
a(n) = my(k=1); while (!isprime(p=(n+1)^k + n^k), k++); k; \\ Michel Marcus, Sep 16 2018
Comments