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.

Showing 1-3 of 3 results.

A129314 Records in A127356.

Original entry on oeis.org

1, 2, 6, 12, 24, 30, 42, 54, 60, 66, 90, 132, 138, 210, 270, 300, 318, 342, 390, 420, 450, 624, 690, 696, 750, 798, 924, 930, 1170, 1224, 1326, 1362, 1428, 1434, 1500
Offset: 1

Views

Author

Klaus Brockhaus, Apr 09 2007

Keywords

Examples

			As can be gathered from A127356, the first six records are A127356(1) = 1, A127356(2) = 2, A127356(3) = 6, A127356(10) = 12, A127356(13) = 24, A127356(77) = 30. Hence a(1) to a(6) are 1, 2, 6, 12, 24, 30.
		

Crossrefs

Cf. A127356, A129315 (where records occur).

Programs

  • Mathematica
    sk[n_]:=Module[{k=2},While[!PrimeQ[n+k^2],k=k+2];k];DeleteDuplicates[ Join[ {1},Table[sk[n],{n,Prime[Range[2,1000000]]}]],GreaterEqual] (* The program generates the first 22 terms of the sequence. *) (* Harvey P. Dale, Nov 07 2022 *)
  • Python
    from itertools import count, islice
    from sympy import isprime, nextprime, prime
    def agen():
        pn = 2; record = 1; yield record
        for n in count(2):
            k, pn = 2, nextprime(pn)
            while not isprime(pn + k*k): k += 2
            if k > record: record = k; yield record
    print(list(islice(agen(), 20))) # Michael S. Branicky, Nov 11 2022

Extensions

a(27)-a(33) from Donovan Johnson, Dec 09 2008
a(34)-a(35) from Michael S. Branicky, Nov 11 2022

A129315 Where records occur in A127356.

Original entry on oeis.org

1, 2, 3, 10, 13, 77, 92, 152, 294, 484, 517, 964, 1203, 2876, 14118, 34279, 81191, 103862, 115370, 195097, 334816, 347938, 2126572, 2787194, 3034023, 5707120, 16513290, 17861702, 19454321, 206814544, 500017558, 551865394, 716440254, 891826049, 1383516280
Offset: 1

Views

Author

Klaus Brockhaus, Apr 09 2007

Keywords

Examples

			The fifth record in A127356 is A129314(5) = 24 = A127356(13), hence a(5) = 13.
		

Crossrefs

Cf. A127356, A129314 (records).

Programs

  • Python
    from itertools import count, islice
    from sympy import isprime, nextprime, prime
    def agen():
        pn = 2; record = 1; yield 1
        for n in count(2):
            k, pn = 2, nextprime(pn)
            while not isprime(pn + k*k): k += 2
            if k > record: record = k; yield n
    print(list(islice(agen(), 20))) # Michael S. Branicky, Nov 11 2022

Extensions

a(27)-a(33) from Donovan Johnson, Dec 09 2008
a(34)-a(35) from Michael S. Branicky, Nov 11 2022

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

Original entry on oeis.org

2, 3, 5, 29, 41, 389, 479, 881, 1931, 3461, 3701, 7589, 9749, 26171, 153089, 405701, 1036829, 1354349, 1516829, 2677289, 4790309, 4990961, 34648631, 46214321, 50583209, 98999969, 305094851, 331498961, 362822099, 4373372351, 11037674441, 12239355719, 16085541359
Offset: 1

Views

Author

Bert Dobbelaere, Jul 15 2019

Keywords

Comments

a(1) = 2 and r(1) = 1.
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).
When omitting the squares in the description, the sequence becomes A002386.

Examples

			a(1) = 2; r(1) = 1.
a(2) = 3; 3 + 1^2 is composite, but 3 + 2^2 is prime, so r(2) = 2.
a(3) = 5; 5 + k^2 is composite for 0 < k < 6, but 5 + 6^2 is prime, so r(3) = 6.
The following are primes: 7 + 2^2, 11 + 6^2, 13 + 2^2, 17 + 6^2, 19 + 2^2, 23 + 6^2.
a(4) = 29; 29 + k^2 is composite for 0 < k < 12, but 29 + 12^2 is prime: r(4) = 12.
		

Crossrefs

Programs

  • PARI
    f(n) = {k=1; while(!isprime(n+k^2), k++); k;}
    lista(NN) = {m=0; forprime(p=1, NN, if(f(p)>m, m=f(p);print1(p,", ")))} \\ Jinyuan Wang, Jul 15 2019
  • Python
    from sympy import isprime, nextprime
    n, p, r = 0, 0, 0
    while(True):
        p = nextprime(p) ; k = 1
        while not isprime(p + k**2):
            k += 1
        if k > r:
            n += 1 ; r = k
            print("a({}) = {}".format(n,p))
    

Extensions

a(30)-a(33) from Giovanni Resta, Jul 16 2019
Showing 1-3 of 3 results.