The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A371024 a(n) is the least prime p such that p + 4*k*(k+1) is prime for 0 <= k <= n-1 but not for k=n. 1

%I #26 Apr 13 2024 22:59:09

%S 2,3,29,5,23,269,272879,149,61463,929,7426253,2609,233,59

%N a(n) is the least prime p such that p + 4*k*(k+1) is prime for 0 <= k <= n-1 but not for k=n.

%C a(15) > 3277860277, a(16) > 3103623446, a(17) > 2853255995,

%C a(18) = 653, a(19) > 2480173428, a(20) > 2058783580, a(21) > 1894529774, a(22) > 1896261075, a(23) > 1836831342, a(24), ..., a(100) > 15000000.

%C Other than a(1)-a(14) and a(18), no terms < 24870000007. - _Michael S. Branicky_, Apr 12 2024

%C From _David A. Corneth_, Apr 12 2024: (Start)

%C Using remainders mod q we can restrict the search. For example for a(15) a term can only be 2, 3 or 5 (mod 7). Or maybe 7 itself. If a(15) = p == 1 (mod 7) then for k = 3 we have q + 4*3*(3+1) == 0 mod 7. Similarily number 0, 4 and 6 (mod 7) produce a multiple of 7 where they should not.

%C Doing so for various primes mod q we can reduce the number of remainders and with that the search space by combining the possible remainders using the Chinese Remainder Theorem (CRT).

%C So the possible remainders mod 2 are 1. The possible remainders mod 3 are 2. Using the CRT, a number of the form 1 (mod 2) and 2 (mod 3) simultaneously is of the form 5 (mod 6).

%C a(15) > 2.3*10^13 if it exists. (End)

%p f:= proc(p) local k;

%p for k from 1 while isprime(p+k*(k+1)*4) do od:

%p k

%p end proc:

%p A:= Vector(12): count:= 0:

%p for i from 1 while count < 12 do

%p v:= f(ithprime(i));

%p if A[v] = 0 then count:= count+1; A[v]:= ithprime(i) fi

%p od:

%p convert(A,list);

%t Table[p=1;m=4;Monitor[Parallelize[While[True,If[And[MemberQ[PrimeQ[Table[p+m*k*(k+1),{k,0,n-1}]],False]==False,PrimeQ[p+m*n*(n+1)]==False],Break[]];p++];p],p],{n,1,10}]

%o (PARI) isok(p, n) = for (k=0, n-1, if (! isprime(p + 4*k*(k+1)), return(0))); return (!isprime(p + 4*n*(n+1)));

%o a(n) = my(p=2); while (!isok(p, n), p=nextprime(p+1)); p; \\ _Michel Marcus_, Mar 12 2024

%o (Python)

%o from sympy import isprime, nextprime

%o from itertools import count, islice

%o def f(p):

%o k = 1

%o while isprime(p+4*k*(k+1)): k += 1

%o return k

%o def agen(verbose=False): # generator of terms

%o adict, n, p = dict(), 1, 1

%o while True:

%o p = nextprime(p)

%o v = f(p)

%o if v not in adict:

%o adict[v] = p

%o if verbose: print("FOUND", v, p)

%o while n in adict:

%o yield adict[n]; n += 1

%o print(list(islice(agen(), 14))) # _Michael S. Branicky_, Apr 12 2024

%Y Cf. A164926, A370387.

%K nonn,more

%O 1,1

%A _J.W.L. (Jan) Eerland_, Mar 08 2024

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 June 6 04:23 EDT 2024. Contains 373114 sequences. (Running on oeis4.)