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

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

Original entry on oeis.org

3, 2, 2, 13, 2, 13, 59, 31, 263, 73, 23, 31, 449, 31, 59, 313, 2, 3, 211, 317, 31, 449, 241, 887, 349, 911, 853, 887, 313, 173, 1777, 179, 967, 503, 331, 113, 163, 359, 1153, 281, 97, 1823, 13, 23, 1657, 269, 223, 3623, 2017, 233, 61, 1361, 367, 1031, 79, 389, 577, 2963, 1741, 59, 13, 1439, 463, 797
Offset: 1

Views

Author

J.W.L. (Jan) Eerland, Dec 21 2024

Keywords

Comments

"Reverse concatenation" here seems to refer 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". - N. J. A. Sloane, Jan 03 2025

Crossrefs

The primes produced are in A379782.

Programs

  • Mathematica
    w = {3};
    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, 57}];
    w
  • Python
    from itertools import count, islice
    from gmpy2 import digits, is_prime, mpz, next_prime
    def agen(): # generator of terms
        r, an = "", 3
        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(), 57))) # Michael S. Branicky, Dec 21 2024

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

Original entry on oeis.org

7, 3, 3, 31, 389, 1021, 2243, 1831, 5849, 15361, 9887, 3877, 4157, 919, 22637, 14449, 27617, 80221, 5039, 51043, 14009, 126079, 24443, 68311, 49193, 47059, 13049, 253681, 271409, 221227, 138869, 116953, 146297, 21841, 1211549, 322501, 212633, 281791, 216071, 1901749, 38747, 116437
Offset: 1

Views

Author

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

Keywords

Examples

			31 is a term because the concatenation of {7,3,3,31} and {13,3,3,7} are respectively 73331 and 13337 which are both prime.
2243 is a term because the concatenation of {7,3,3,31,389,1021,2243} and {3422,1201,983,13,3,3,7} are respectively 7333138910212243 and 3422120198313337 which are both prime.
		

Crossrefs

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:= 7: x:= 7:
    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={7};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 = "", "", 7
        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))) # Michael S. Branicky, Jan 02 2025

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

A202997 a(1) = 3 ; a(n+1) is the prime number obtained by the concatenation {p, a(n)} where p is the smallest prime prefix.

Original entry on oeis.org

3, 23, 223, 31223, 231223, 31231223, 2931231223, 372931231223, 17372931231223, 1317372931231223, 1971317372931231223, 1571971317372931231223, 891571971317372931231223, 79891571971317372931231223, 25179891571971317372931231223, 4325179891571971317372931231223
Offset: 1

Views

Author

Michel Lagneau, Dec 27 2011

Keywords

Comments

By Xylouris' version of Linnik's theorem, a(n) << 3^(6.2^n + cn) for some constant c. [Charles R Greathouse IV, Dec 27 2011]

Examples

			a(1) = 3;
a(2) = 23 because 2 is the smallest prime prefix and 23 is prime;
a(3) = 223 because 2 is the smallest prime prefix and 223 is prime;
a(4) = 31223 because 31 is the smallest prime prefix and 31223 is prime.
		

Crossrefs

Programs

  • Maple
    a0:=3: printf(`%d, `,a0):for it from 1 to 20 do: i:=0:for n from 1 to 1000 while(i=0)  do:p0:=ithprime(n):n0:=length(a0):x:=p0*10^n0+a0: if type(x,prime)=true then printf(`%d, `,x):i:=1:a0:=x:else fi:od:od:

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