login
Primes of the form 2^(n-1)*n^2-(-1)^n.
1

%I #10 Sep 07 2012 04:57:51

%S 2,7,37,127,401,1151,3137,8191,51199,294911,1605631,3686401,209715199,

%T 10485760001,8131987999031297,155444555888459777,

%U 139751824747451132596033945601,3429749540386513119227714380314826357885676055272856607522817

%N Primes of the form 2^(n-1)*n^2-(-1)^n.

%C Generated by n: 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 15, 20, 25, 43, 47, 85, 187, 188, 206, 275, 292 ...

%C Primes of the form 2^(n-1)*n^2+(-1)^n are 1153, 44530220924929, ...

%e a(1) = 2 (= 2^(1 - 1)*1^2 - (-1)^1 = 1 + 1),

%e a(2) = 7 (= 2^(2 - 1)*2^2 - (-1)^2 = 8 - 1),

%e a(3) = 37 (= 2^(3 - 1)*3^2 - (-1)^3 = 36 + 1),

%e a(4) = 127 (= 2^(4 - 1)*4^2 - (-1)^4 = 128 - 1),

%e a(5) = 401 (= 2^(5 - 1)*5^2 - (-1)^5 = 400 + 1),

%e a(6) = 1151 (= 2^(6 - 1)*6^2 - (-1)^6 = 1152 - 1),

%e a(7) = 3137 (= 2^(7 - 1)*7^2 - (-1)^7 = 3136 + 1),

%e a(8) = 8191 (= 2^(8 - 1)*8^2 - (-1)^8 = 8192 - 1).

%t a={}; For[n = 1, n <= 300, n++, {v = 2^(n-1)*n^2-(-1)^n; If[PrimeQ[v], AppendTo[a, v]]}]; a [_John W. Layman_, Sep 06 2012]

%o (PARI)

%o for (n=1,10^3, t=2^(n-1)*n^2-(-1)^n; if (isprime(t), print1(t,", ")));

%o /* _Joerg Arndt_, Sep 05 2012 */

%K nonn

%O 1,1

%A _Juri-Stepan Gerasimov_, Sep 05 2012