OFFSET
1,2
COMMENTS
Sequence is infinite: if 2n-1 is composite then n^2 is in the sequence. (Proof: If n^2 = x^2 + p with p prime, then p = (n-x)(n+x), so n-x=1 and n+x=p. Hence 2n-1=p is prime, not composite.) - Dean Hickerson, Nov 27 2002
There are no prime numbers in this sequence because at the very least they can be represented as p + 0^2. - Alonso del Arte, May 26 2012
Number of terms <10^k,k=0..8: 1, 8, 27, 75, 223, 719, 2361, 7759, ..., . - Robert G. Wilson v, May 26 2012
So far there are only 21 terms which are not squares and they are the terms of A020495. Those that are squares, their square roots are members of A104275. - Robert G. Wilson v, May 26 2012
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..10000 (first 115 terms from T. D. Noe)
EXAMPLE
From Alonso del Arte, May 26 2012: (Start)
10 is in the sequence because none of 10 - p_i are square (8, 7, 5, 3) and none of 10 - b^2 are prime (10, 9, 6, 1); i goes from 1 to pi(10) or b goes from 0 to floor(sqrt(10)).
11 is not in the sequence because it can be represented as 3^2 + 2 or 0^2 + 11. (End)
MATHEMATICA
t={}; Do[k=0; While[k^2<n && !PrimeQ[n-k^2], k++ ]; If[k^2>=n, AppendTo[t, n]], {n, 25000}]; t (* T. D. Noe, Aug 05 2006 *)
max = 5000; Complement[Range[max], Flatten[Table[Prime[p] + b^2, {p, PrimePi[max]}, {b, 0, Ceiling[Sqrt[max]]}]]] (* Alonso del Arte, May 26 2012 *)
fQ[n_] := Block[{j = Sqrt[n], k}, If[ IntegerQ[j] && !PrimeQ[2j - 1], True, k = Floor[j]; While[k > -1 && !PrimeQ[n - k^2], k--]; If[k == -1, True, False]]]; Select[ Range[3600], fQ] (* Robert G. Wilson v, May 26 2012 *)
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
STATUS
approved