A080121 a(n) is the smallest k > 0 such that n^2^k + (n+1)^2^k is prime, or -1 if no such k exists.
1, 1, 2, 1, 1, 2, 1, 2, 1, 5
Offset: 1
Links
Formula
Extensions
Edited by Max Alekseyev, Sep 09 2020
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
a(101)=16 because 101^16 + 102^16 = 254536435001431070450581794495937.
Table[ k = 0; While[ !PrimeQ[ (n + 1)^(2^k) + n^(2^k) ], k++ ]; 2^k, {n, 1, 27} ]
a(n) = my(k=1); while (!isprime(p=(n+1)^k + n^k), k++); k; \\ Michel Marcus, Sep 16 2018
a(7) = 2 since (7^(2^0)+1)/2 and (7^(2^1)+1)/2 are not primes, but (7^(2^2)+1)/2 = 1201 is prime. a(14) = 1 since 14^(2^0)+1 is not prime, but 14^(2^1)+1 = 197 is prime.
Table[k=0; While[p=If[EvenQ[n], (2n)^(2^k)+1, ((2n)^(2^k)+1)/2]; k<12 && !PrimeQ[p], k=k+1]; If[k==12, -1, k], {n, 2, 1500}]
f(n) = for(k=0, 11, if(ispseudoprime(n^(2^k)+1), return(k))); -1 g(n) = for(k=0, 11, if(ispseudoprime((n^(2^k)+1)/2), return(k))); -1 a(n) = if(n%2==0, f(n), g(n))
f(n,k)=if(n%2, (n^(2^k)+1)/2, n^(2^k)+1) a(n)=if(ispower(-n), -1, my(k); while(!ispseudoprime(f(n,k)), k++); k) \\ Charles R Greathouse IV, Apr 20 2015
Comments