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.

A309179 Primes to which a record size square needs to be added to reach another prime.

This page as a plain text file.
%I A309179 #19 May 22 2025 10:21:48
%S A309179 2,3,5,29,41,389,479,881,1931,3461,3701,7589,9749,26171,153089,405701,
%T A309179 1036829,1354349,1516829,2677289,4790309,4990961,34648631,46214321,
%U A309179 50583209,98999969,305094851,331498961,362822099,4373372351,11037674441,12239355719,16085541359
%N A309179 Primes to which a record size square needs to be added to reach another prime.
%C A309179 a(1) = 2 and r(1) = 1.
%C A309179 For n > 1, a(n) is the smallest prime for which r(n) > r(n-1) exists so that a(n) + r(n)^2 is prime and a(n) + k^2 are composite for 0 < k < r(n).
%C A309179 When omitting the squares in the description, the sequence becomes A002386.
%e A309179 a(1) = 2; r(1) = 1.
%e A309179 a(2) = 3; 3 + 1^2 is composite, but 3 + 2^2 is prime, so r(2) = 2.
%e A309179 a(3) = 5; 5 + k^2 is composite for 0 < k < 6, but 5 + 6^2 is prime, so r(3) = 6.
%e A309179 The following are primes: 7 + 2^2, 11 + 6^2, 13 + 2^2, 17 + 6^2, 19 + 2^2, 23 + 6^2.
%e A309179 a(4) = 29; 29 + k^2 is composite for 0 < k < 12, but 29 + 12^2 is prime: r(4) = 12.
%o A309179 (Python)
%o A309179 from sympy import isprime, nextprime
%o A309179 n, p, r = 0, 0, 0
%o A309179 while(True):
%o A309179     p = nextprime(p) ; k = 1
%o A309179     while not isprime(p + k**2):
%o A309179         k += 1
%o A309179     if k > r:
%o A309179         n += 1 ; r = k
%o A309179         print("a({}) = {}".format(n,p))
%o A309179 (PARI) f(n) = {k=1; while(!isprime(n+k^2), k++); k;}
%o A309179 lista(NN) = {m=0; forprime(p=1, NN, if(f(p)>m, m=f(p);print1(p,", ")))} \\ _Jinyuan Wang_, Jul 15 2019
%Y A309179 Cf. A002386, A020495, A065376, A127356, A129314.
%K A309179 nonn
%O A309179 1,1
%A A309179 _Bert Dobbelaere_, Jul 15 2019
%E A309179 a(30)-a(33) from _Giovanni Resta_, Jul 16 2019