OFFSET
1,2
COMMENTS
By the conjecture in A230494, we should have a(n) > 0 for all n > 1.
LINKS
Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
EXAMPLE
a(4) = 3 since neither 4 - 1 = 3 nor 4 - 2 = 2 is a square, but 4 - 3 = 1 is a square and 2*3^2 - 1 = 17 is a prime.
MATHEMATICA
SQ[n_]:=IntegerQ[Sqrt[n]]
Do[Do[If[PrimeQ[2k^2-1]&&SQ[n-k], Print[n, " ", k]; Goto[aa]], {k, 1, n}];
Print[n, " ", 0]; Label[aa]; Continue, {n, 1, 60}]
lpik[n_]:=Module[{k=1}, While[!PrimeQ[2k^2-1]||!IntegerQ[Sqrt[n-k]], k++]; k]; Join[{0}, Array[lpik, 60, 2]] (* Harvey P. Dale, Aug 04 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Zhi-Wei Sun, Oct 23 2013
STATUS
approved