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

%I #8 Aug 04 2021 14:25:13

%S 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,

%T 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,

%U 11

%N 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.

%C By the conjecture in A230494, we should have a(n) > 0 for all n > 1.

%H Zhi-Wei Sun, <a href="/A230546/b230546.txt">Table of n, a(n) for n = 1..10000</a>

%e 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.

%t SQ[n_]:=IntegerQ[Sqrt[n]]

%t Do[Do[If[PrimeQ[2k^2-1]&&SQ[n-k],Print[n," ",k];Goto[aa]],{k,1,n}];

%t Print[n," ",0];Label[aa];Continue,{n,1,60}]

%t 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 *)

%Y Cf. A000040, A000290, A066049, A230351, A230362, A230493, A230494.

%K nonn

%O 1,2

%A _Zhi-Wei Sun_, Oct 23 2013

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 23 11:35 EDT 2024. Contains 371912 sequences. (Running on oeis4.)