login
a(n) is the smallest integer k such that ((2^n + 1)^k - 1)/(2^n) is prime, or -1 if no such k exists.
1

%I #18 Dec 03 2025 10:59:23

%S 2,3,3,-1,3,3,19,5,23,17,13,3,7

%N a(n) is the smallest integer k such that ((2^n + 1)^k - 1)/(2^n) is prime, or -1 if no such k exists.

%C Presumably all terms are prime numbers, if they exist.

%e a(0) = 2 because ((2^0+1)^2-1)/2^0 = 3 (prime);

%e a(1) = 3 because ((2^1+1)^3-1)/2^1 = 13 (prime);

%e a(2) = 3 because ((2^2+1)^3-1)/2^2 = 43 (prime);

%e a(4) = 3 because ((2^4+1)^3-1)/2^4 = 307 (prime);

%e a(5) = 3 because ((2^5+1)^3-1)/2^5 = 1123 (prime).

%t a[n_]:=Module[{k=1},If[n==3,-1,While[!PrimeQ[((2^n+1)^k-1)/(2^n)],k++];k]];Array[a,13,0] (* _James C. McMahon_, Dec 03 2025 *)

%o (Magma) [2, 3, 3, -1] cat [Min([k: k in [1..100] | ((2^n+1)^k-1) mod 2^n eq 0 and IsPrime(((2^n+1)^k-1) div 2^n)]): n in [4..12]];

%o (PARI) a(n) = if(n==3, return(-1)); my(k=1); while (!isprime(((2^n+1)^k - 1)/2^n), k++); k; \\ _Michel Marcus_, Nov 26 2025

%Y Cf. A000051, A000079, A246005.

%Y Primes p such that ((2^m+1)^p - 1)/2^m is prime: A000043 (m = 0), A028491 (m = 1), A004061 (m = 2), no sequence in case m = 3 (see comment in A002452), A006034 (m = 4), A209120 (m = 5).

%K sign,more

%O 0,1

%A _Juri-Stepan Gerasimov_, Nov 25 2025