OFFSET
1,2
COMMENTS
0 and the squares of numbers k such that 2k+1 and 2k-1 are not primes; i.e., 0 and the squares of the terms of A104278.
LINKS
Muniru A Asiru, Table of n, a(n) for n = 1..20000
FORMULA
a(1) = 0; for n > 1, A104278(n-1)^2.
EXAMPLE
The absolute difference between any square j^2 and 169 is |j^2 - 169| = |(j-13)*(j+13)| = |j-13|*|j+13|, which cannot be a prime unless one of the two factors |j-13| and |j+13| is 1, i.e., j is -14, -12, 12, or 14; however, in each case, the other factor is nonprime (-27, -25, 25, or 27, respectively), so |j^2 - 169| is not a prime for any integer j. Thus, 169 is in the sequence.
49 - 6^2 = 49 - 36 = 13 (a prime), so 49 is not in the sequence.
MATHEMATICA
Join[{0}, Select[Range[200], CompositeQ[2# + 1] && CompositeQ[2# - 1]&]^2] (* Jean-François Alcover, Dec 21 2017 *)
PROG
(GAP) o := [];; for n in [1..10^4] do if not IsPrime(2*n-1) and not IsPrime(2*n+1) then Add(o, n^2); fi; od;
sequence := Concatenation([0], o); # Muniru A Asiru, Jan 01 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Jon E. Schoenfield, Dec 10 2017
STATUS
approved