login
Numbers n such that 1 + n + n^3 + n^5 + n^7 + n^9 + n^11 + ... + n^37 + n^39 is prime.
5

%I #31 Sep 08 2022 08:45:28

%S 42,47,60,119,153,179,195,236,269,287,383,821,846,921,924,1104,1181,

%T 1200,1349,1806,1917,1980,2015,2049,2057,2369,2394,2522,2660,2876,

%U 2882,2940,2991,3206,3311,3570,3695,3741,3785,3840,3944,3966,4049,4148,4377,4448

%N Numbers n such that 1 + n + n^3 + n^5 + n^7 + n^9 + n^11 + ... + n^37 + n^39 is prime.

%H Vincenzo Librandi, <a href="/A124189/b124189.txt">Table of n, a(n) for n = 1..195</a>

%p a:= proc(n) option remember; local k;

%p for k from 1 +`if`(n=1, 1, a(n-1)) while

%p not isprime(1+(k^41-k)/(k^2-1)) do od; k

%p end:

%p seq(a(n), n=1..40); # _Alois P. Heinz_, Jun 26 2014

%t Do[If[PrimeQ[1+n+n^3+n^5+n^7+n^9+n^11+n^13+n^15+n^17+n^19 +n^21 +n^23 +n^25 +n^27+n^29+n^31+ n^33+n^35+n^37+n^39],Print[n]],{n,1,2400}]

%t Select[Range[5000], PrimeQ[Total[#^Range[1, 39, 2]] + 1] &] (* _Vincenzo Librandi_, Jun 27 2014 *)

%o (Magma) [n: n in [0..4000] | IsPrime(s) where s is 1+&+[n^i: i in [1..39 by 2]]]; // _Vincenzo Librandi_, Nov 12 2010, revised Jun 27 2014

%o (PARI) for(n=1, 10^4, if(ispseudoprime(sum(i=0, 19, n^(2*i+1))+1), print1(n,", "))) \\ _Derek Orr_, Jun 24 2014

%Y Cf. A049407.

%K nonn

%O 1,1

%A _Artur Jasinski_, Dec 13 2006

%E a(43) and beyond from _Derek Orr_, Jun 24 2014