login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A230546 Least positive integer k <= n such that 2*k^2-1 is a prime and n - k is a square, or 0 if such an integer k does not exist. 1
0, 2, 2, 3, 4, 2, 3, 4, 8, 6, 2, 3, 4, 10, 6, 7, 8, 2, 3, 4, 17, 6, 7, 8, 21, 10, 2, 3, 4, 21, 6, 7, 8, 18, 10, 11, 21, 2, 3, 4, 25, 6, 7, 8, 36, 10, 11, 39, 13, 25, 2, 3, 4, 18, 6, 7, 8, 22, 10, 11 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
By the conjecture in A230494, we should have a(n) > 0 for all n > 1.
LINKS
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
Sequence in context: A236241 A127731 A159978 * A286617 A328446 A371306
KEYWORD
nonn
AUTHOR
Zhi-Wei Sun, Oct 23 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 20 11:27 EDT 2024. Contains 371838 sequences. (Running on oeis4.)