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-4 of 4 results.

A380010 Beginning with 7, least prime such that concatenation of the first n terms is prime.

Original entry on oeis.org

7, 3, 3, 3, 31, 23, 13, 3, 167, 13, 137, 3, 73, 383, 499, 431, 13, 101, 61, 47, 67, 101, 13, 83, 1237, 107, 97, 467, 499, 677, 1423, 353, 73, 431, 331, 683, 487, 2141, 3, 1753, 1787, 31, 443, 139, 653, 1327, 17, 919, 173, 2851, 137, 547, 557, 5167, 347, 7867, 839, 19, 179, 19
Offset: 1

Views

Author

J.W.L. (Jan) Eerland, Jan 09 2025

Keywords

Crossrefs

Programs

  • Mathematica
    w={7};Do[k=1;q=Monitor[Parallelize[While[True,If[PrimeQ[FromDigits[Join@@IntegerDigits/@Append[w,Prime[k]]]],Break[]];k++];Prime[k]],k];w=Append[w,q],{i,2,50}];w
  • Python
    from itertools import count, islice
    from gmpy2 import digits, is_prime, mpz, next_prime
    def agen(): # generator of terms
        s, an = "", 7
        while True:
            yield int(an)
            s += digits(an)
            p = 3
            while not is_prime(mpz(s+digits(p))): p = next_prime(p)
            an = p
    print(list(islice(agen(), 50))) # after Michael S. Branicky in A379354

A380011 Beginning with 7, least prime such that the reversal concatenation of the first n terms is prime.

Original entry on oeis.org

7, 3, 3, 13, 3, 2, 13, 47, 43, 47, 37, 41, 109, 41, 139, 149, 109, 263, 73, 563, 163, 41, 19, 797, 61, 107, 31, 821, 43, 149, 37, 953, 211, 89, 547, 353, 337, 167, 67, 239, 1009, 449, 97, 23, 349, 41, 31, 911, 61, 929, 229, 797, 331, 191, 463, 107, 463, 809, 2887, 971
Offset: 1

Views

Author

J.W.L. (Jan) Eerland, Jan 09 2025

Keywords

Comments

"Reverse concatenation" here refers to the decimal concatenation R(a(n)) || R(a(n-1)) || ... || R(a(3)) || R(a(2)) || R(a(1)) where R(k) means "reverse digits of k".

Crossrefs

Programs

  • Mathematica
    w={7};Do[k=1;q=Monitor[Parallelize[While[True,If[PrimeQ[FromDigits[Join@@IntegerDigits/@Reverse[IntegerDigits[FromDigits[Join@@IntegerDigits/@Append[w,Prime[k]]]]]]],Break[]];k++];Prime[k]],k];w=Append[w,q],{i,2,50}];w
  • Python
    from itertools import count, islice
    from gmpy2 import digits, is_prime, mpz, next_prime
    def agen(): # generator of terms
        r, an = "", 7
        while True:
            yield int(an)
            r = digits(an)[::-1] + r
            p = 2
            while not is_prime(mpz(digits(p)[::-1]+r)): p = next_prime(p)
            an = p
    print(list(islice(agen(), 50))) # after Michael S. Branicky in A379355

A380227 Beginning with 11, least prime such that concatenation of first n terms and its digit reversal both are primes.

Original entry on oeis.org

11, 3, 11, 31, 59, 463, 131, 103, 599, 3253, 7649, 439, 12791, 2953, 17321, 16651, 10007, 51787, 4871, 1483, 6857, 15649, 53051, 61441, 84449, 35533, 19913, 39097, 23081, 206527, 44939, 189517, 32369, 106657, 606899, 117703, 222977, 220903, 69779, 12007, 95063, 136471, 43973
Offset: 1

Views

Author

J.W.L. (Jan) Eerland, Jan 17 2025

Keywords

Crossrefs

Cf. A113584 (same for 3), A379761 (same for 7).

Programs

  • Maple
    rev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    tcat:= proc(a,b)
      a*10^(1+ilog10(b))+b
    end proc:
    A:= 11: x:= 11:
    for i from 1 to 50 do
       p:= 2:
       do
         p:= nextprime(p);
         y:= tcat(x,p);
         if isprime(y) and isprime(rev(y)) then
              A:= A,p;
              x:= y;
              break
         fi;
       od
    od:
    A; # after Robert Israel in A113584
  • Mathematica
    w={11};Do[k=1;q=Monitor[Parallelize[While[True,If[PrimeQ[FromDigits[Join@@IntegerDigits/@Reverse[IntegerDigits[FromDigits[Join@@IntegerDigits/@Append[w,Prime[k]]]]]]]&&PrimeQ[FromDigits[Join@@IntegerDigits/@Append[w,Prime[k]]]],Break[]];k++];Prime[k]],{i,k}];w=Append[w,q],{i,2,50}];w
  • Python
    from itertools import count, islice
    from gmpy2 import digits, is_prime, mpz, next_prime
    def agen(): # generator of terms
        s, r, an = "", "", 11
        while True:
            yield int(an)
            d = digits(an)
            s, r, p, sp = s+d, d[::-1]+r, 3, "3"
            while not is_prime(mpz(s+sp)) or not is_prime(mpz(sp[::-1]+r)):
                p = next_prime(p)
                sp = digits(p)
            an = p
    print(list(islice(agen(), 40))) # after Michael S. Branicky in A113584

A382898 Beginning with 13, least prime such that concatenation of first n terms and its digit reversal both are primes.

Original entry on oeis.org

13, 151, 227, 2083, 887, 79, 2963, 1579, 6287, 1321, 6719, 54919, 26699, 8647, 4229, 3919, 102161, 42433, 1667, 192193, 11633, 186343, 47339, 3259, 65963, 14293, 29717, 61297, 28493, 231367, 43793, 145021, 566441, 475903, 92381, 80473, 139967, 882061, 72893, 709279, 6053, 114487, 1179389, 204331, 203351, 139831, 396239, 205327, 501173, 951589
Offset: 1

Views

Author

J.W.L. (Jan) Eerland, Apr 08 2025

Keywords

Crossrefs

Cf. A113584 (same for 3), A379761 (same for 7), A380227 (same for 11).

Programs

  • Maple
    rev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    tcat:= proc(a,b)
      a*10^(1+ilog10(b))+b
    end proc:
    A:= 13: x:= 13:
    for i from 1 to 50 do
       p:= 2:
       do
         p:= nextprime(p);
         y:= tcat(x,p);
         if isprime(y) and isprime(rev(y)) then
              A:= A,p;
              x:= y;
              break
         fi;
       od
    od:
    A; # after Robert Israel in A113584
  • Mathematica
    w={13};Do[k=1;q=Monitor[Parallelize[While[True,If[PrimeQ[FromDigits[Join@@IntegerDigits/@Reverse[IntegerDigits[FromDigits[Join@@IntegerDigits/@Append[w,Prime[k]]]]]]]&&PrimeQ[FromDigits[Join@@IntegerDigits/@Append[w,Prime[k]]]],Break[]];k++];Prime[k]],{i,k}];w=Append[w,q],{i,2,50}];w
  • Python
    from itertools import count, islice
    from gmpy2 import digits, is_prime, mpz, next_prime
    def agen(): # generator of terms
        s, r, an = "", "", 13
        while True:
            yield int(an)
            d = digits(an)
            s, r, p, sp = s+d, d[::-1]+r, 3, "3"
            while not is_prime(mpz(s+sp)) or not is_prime(mpz(sp[::-1]+r)):
                p = next_prime(p)
                sp = digits(p)
            an = p
    print(list(islice(agen(), 40))) # after Michael S. Branicky in A113584
Showing 1-4 of 4 results.