cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A350868 a(n) is the first prime p such that the next n primes are p+2*k^2 for k=1..n.

This page as a plain text file.
%I A350868 #26 Jan 31 2022 06:46:20
%S A350868 2,3,29,569,6701,64919,1720289,256828391,33090566651,248804328761,
%T A350868 55130906480861,119321483551349
%N A350868 a(n) is the first prime p such that the next n primes are p+2*k^2 for k=1..n.
%C A350868 If p = prime(m) is a prime such that the next n primes are p+2*k^2 for k=1..n, then A212769(m+k-1) = 2*p+1 for k=1..n.
%C A350868 a(12) > 10^15. - _Martin Ehrenstein_, Jan 31 2022
%e A350868 a(3) = 569 because the next 3 primes after 569 are 571 = 569 + 2*1^2, 577 = 569 + 2*2^2, 587 = 569 + 2*3^2, and 569 is the first prime that works.
%p A350868 P:= select(isprime, [2,seq(i,i=3..2*10^6,2)]):
%p A350868 f:= proc(n) local k;
%p A350868      for k from 1 do
%p A350868        if P[n+k] <> P[n]+2*k^2 then return k-1 fi
%p A350868      od
%p A350868 end proc:
%p A350868 V:= Array(0..6):
%p A350868 for n from 1 to nops(P)-21 do
%p A350868   v:= H(n);
%p A350868   if V[v] = 0 then V[v]:= P[n] fi;
%p A350868 od:
%p A350868 convert(V,list);
%o A350868 (Python)
%o A350868 from sympy import prime, nextprime
%o A350868 def A350868(n):
%o A350868     if n < 2:
%o A350868         return 2+n
%o A350868     qlist = [prime(i)-2 for i in range(2,n+2)]
%o A350868     p = prime(n+1)
%o A350868     mlist = [2*k**2 for k in range(1,n+1)]
%o A350868     while True:
%o A350868         if qlist == mlist:
%o A350868             return p-mlist[-1]
%o A350868         qlist = [q-qlist[0] for q in qlist[1:]]
%o A350868         r = nextprime(p)
%o A350868         qlist.append(r-p+qlist[-1])
%o A350868         p = r # _Chai Wah Wu_, Jan 24 2022
%Y A350868 Cf. A212769.
%K A350868 nonn,more
%O A350868 0,1
%A A350868 _J. M. Bergot_ and _Robert Israel_, Jan 20 2022
%E A350868 a(7) from _David A. Corneth_, Jan 20 2022
%E A350868 a(8) from _Chai Wah Wu_, Jan 25 2022
%E A350868 a(9) from _Martin Ehrenstein_, Jan 26 2022
%E A350868 a(10)-a(11) from _Martin Ehrenstein_, Jan 31 2022