OFFSET
1,1
COMMENTS
LINKS
Colin Barker and Charles R Greathouse IV, Table of n, a(n) for n = 1..10000 (first 800 terms from Barker)
EXAMPLE
2, 3, 7 are in this sequence because first three sums of two consecutive nonsquares are 5, 8, 11 and 2, 3, 7 are primes.
MATHEMATICA
Union[{2}, Select[Table[2n^2-1, {n, 0, 1000}], PrimeQ], Select[Table[2n^2+1, {n, 0, 1000}], PrimeQ]] (* Ivan N. Ianakiev, Apr 24 2015 *)
Module[{nn=11000, ns}, ns=Total/@Partition[Select[Range[nn], !IntegerQ[Sqrt[#]]&], 2, 1]; Complement[ Prime[Range[PrimePi[Last[ns]]]], ns]] (* Harvey P. Dale, Mar 06 2024 *)
PROG
(PARI)
a256917(maxp) = {
ps=[2];
k=1; while((t=2*k^2-1)<=maxp, k++; if(isprime(t), ps=setunion(ps, [t])));
k=1; while((t=2*k^2+1)<=maxp, k++; if(isprime(t), ps=setunion(ps, [t])));
ps
}
a256917(11000) \\ Colin Barker, Apr 23 2015
(PARI) list(lim)=my(v=List([2]), t); for(k=2, sqrtint((lim+1)\2), if(isprime(t=2*k^2-1), listput(v, t))); for(k=1, sqrtint((lim-1)\2), if(isprime(t=2*k^2+1), listput(v, t))); Set(v) \\ Charles R Greathouse IV, Apr 23 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Juri-Stepan Gerasimov, Apr 23 2015
STATUS
approved