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.

Previous Showing 11-20 of 45 results. Next

A052024 Every suffix of palindromic prime a(n) is prime (left-truncatable).

Original entry on oeis.org

2, 3, 5, 7, 313, 353, 373, 383, 797, 30103, 31013, 70607, 73037, 76367, 79397, 3002003, 7096907, 7693967, 700090007, 799636997, 70060906007, 3000002000003, 7030000000307, 300000020000003, 300001030100003, 310000060000013, 38000000000000000000083, 30000000004000300040000000003, 3000001000000000000000000000001000003
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    d[n_]:=IntegerDigits[n]; ltrQ[n_]:=And@@PrimeQ[NestWhileList[FromDigits[Drop[d[#],1]]&,n,#>9&]]; palQ[n_]:=Reverse[x=d[n]]==x; Select[Prime[Range[550000]],palQ[#]&<rQ[#]&] (* Jayanta Basu, Jun 02 2013 *)
  • Python
    from sympy import isprime
    from itertools import count, islice
    def agen(verbose=False):
        prime_strings, alst = {"3", "7"}, []
        yield from [2, 3, 5, 7]
        for digs in count(2):
            new_prime_strings = set()
            for p in prime_strings:
                for d in "123456789":
                    ts = d + "0"*(digs-1-len(p)) + p
                    if isprime(int(ts)):
                        new_prime_strings.add(ts)
            prime_strings |= new_prime_strings
            pals = [int(s) for s in new_prime_strings if s == s[::-1]]
            yield from sorted(pals)
            if verbose: print("...", digs, len(prime_strings), time()-time0)
    print(list(islice(agen(), 20))) # Michael S. Branicky, Apr 04 2022

Extensions

Inserted missing 31013 by Jayanta Basu, Jun 02 2013
a(27)-a(29) from Michael S. Branicky, Apr 04 2022

A137812 Left- or right-truncatable primes.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 23, 29, 31, 37, 43, 47, 53, 59, 67, 71, 73, 79, 83, 97, 113, 131, 137, 139, 167, 173, 179, 197, 223, 229, 233, 239, 271, 283, 293, 311, 313, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 397, 431, 433, 439, 443, 467, 479, 523, 547, 571
Offset: 1

Views

Author

T. D. Noe, Feb 11 2008

Keywords

Comments

Repeatedly removing a digit from either the left or right produces only primes. There are 149677 terms in this sequence, ending with 8939662423123592347173339993799.
The number of n-digit terms is A298048(n). - Jon E. Schoenfield, Jan 28 2022

Examples

			139 is here because (removing 9 from the right) 13 is prime and (removing 1 from the left) 3 is prime.
		

Crossrefs

Cf. A024770 (right-truncatable primes), A024785 (left-truncatable primes), A077390 (left-and-right truncatable primes), A080608.
Cf. A298048 (number of n-digit terms).

Programs

  • Mathematica
    Clear[s]; s[0]={2,3,5,7}; n=1; While[s[n]={}; Do[k=s[n-1][[i]]; Do[p=j*10^n+k; If[PrimeQ[p], AppendTo[s[n],p]], {j,9}]; Do[p=10*k+j; If[PrimeQ[p], AppendTo[s[n],p]], {j,9}], {i,Length[s[n-1]]}]; s[n]=Union[s[n]]; Length[s[n]]>0, n++ ];t=s[0]; Do[t=Join[t,s[i]], {i,n}]; t
  • Python
    from sympy import isprime
    def agen():
        primes = [2, 3, 5, 7]
        while len(primes) > 0:
            yield from primes
            cands = set(int(d+str(p)) for p in primes for d in "123456789")
            cands |= set(int(str(p)+d) for p in primes for d in "1379")
            primes = sorted(c for c in cands if isprime(c))
    afull = [an for an in agen()]
    print(afull[:60]) # Michael S. Branicky, Aug 04 2022

A227916 Primes that remain prime when the leftmost digit is removed.

Original entry on oeis.org

13, 17, 23, 37, 43, 47, 53, 67, 73, 83, 97, 103, 107, 113, 131, 137, 167, 173, 179, 197, 211, 223, 229, 241, 271, 283, 307, 311, 313, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 389, 397, 419, 431, 443, 461, 467, 479, 503, 523, 541, 547, 571, 607, 613, 617
Offset: 1

Views

Author

K. D. Bajpai, Oct 13 2013

Keywords

Examples

			a(11)= 97 which is prime. Removing the leftmost digit gives 7, also prime.
a(28)= 311 which is prime. Removing the leftmost digit gives 11, also prime.
		

Crossrefs

Cf. A000040 (prime numbers), A024785 (left-truncatable primes).
Cf. A137812 (left- or right-truncatable primes).
Cf. A227919 (primes which remain prime when rightmost digit is removed).

Programs

  • Maple
    KD:= proc() local a,b,c,d; a:=ithprime(n);b:=length(a); c:=floor(a/(10^(b-1)));d:=a-c*(10^(b-1));if isprime(d) then return(a):fi; end:seq(KD(),n=1..5000);

A024781 Every suffix prime and no 0 digits in base 6 (written in base 6).

Original entry on oeis.org

2, 3, 5, 15, 25, 35, 45, 115, 125, 135, 215, 225, 245, 335, 345, 435, 445, 515, 525, 1115, 1125, 1245, 1335, 1345, 1435, 1445, 2115, 2135, 2225, 2335, 2345, 2435, 3125, 3445, 3515, 4115, 4215, 4225, 4435, 4525, 5215, 5245, 5345, 5525, 11115, 11245, 12135
Offset: 1

Views

Author

Keywords

Comments

The final term is a(454) = 14141511414451435.

Crossrefs

Programs

  • Maple
    a:=[[2], [3], [5]]: b:=[]: l1:=1: l2:=5: do for j from l1 to l2 do for k from 1 to 5 do d:=[op(a[j]),k]: if(isprime(op(convert(d, base, 6, 6^nops(d)))))then a:=[op(a), d]: fi: od: od: l1:=l2+1: l2:=nops(a): if(l1>l2)then break: fi: od: for j from 1 to nops(a) do b:=[op(b),op(convert(a[j], base, 10, 10^nops(a[j])))]: od: b:=sort(b): seq(b[j],j=1..nops(b)); # Nathaniel Johnston, Jun 21 2011
  • Python
    from sympy import isprime
    def afull():
        prime_strings, alst = list("235"), []
        while len(prime_strings) > 0:
            alst.extend(sorted(int(p) for p in prime_strings))
            candidates = set(d+p for p in prime_strings for d in "12345")
            prime_strings = [c for c in candidates if isprime(int(c, 6))]
        return alst
    print(afull()) # Michael S. Branicky, Apr 27 2022

A024783 Every suffix prime and no 0 digits in base 8 (written in base 8).

Original entry on oeis.org

2, 3, 5, 7, 13, 15, 23, 27, 35, 37, 45, 53, 57, 65, 73, 75, 123, 145, 153, 213, 227, 235, 265, 323, 337, 345, 357, 373, 415, 445, 475, 513, 535, 557, 565, 573, 615, 645, 657, 673, 715, 723, 737, 753, 775, 1145, 1153, 1357, 1475, 1737, 1775, 2213, 2235, 2535, 3123, 3145
Offset: 1

Views

Author

Keywords

Comments

The final term of the sequence is a(446) = 313636165537775.

Crossrefs

Programs

  • Maple
    a:=[[2],[3],[5],[7]]: l1:=1: l2:=4: do for k from 1 to 7 do for j from l1 to l2 do d:=[op(a[j]),k]: if(isprime(op(convert(d, base, 8, 8^nops(d)))))then a:=[op(a), d]: fi: od: od: l1:=l2+1: l2:=nops(a): if(l1>l2)then break: fi: od: seq(op(convert(a[j], base, 10, 10^nops(a[j]))), j=1..nops(a)); # Nathaniel Johnston, Jun 21 2011
  • Python
    from sympy import isprime
    def afull():
        prime_strings, alst = list("2357"), []
        while len(prime_strings) > 0:
            alst.extend(sorted(int(p) for p in prime_strings))
            candidates = set(d+p for p in prime_strings for d in "1234567")
            prime_strings = [c for c in candidates if isprime(int(c, 8))]
        return alst
    print(afull()) # Michael S. Branicky, Apr 27 2022

A024784 Every suffix prime and no 0 digits in base 9 (written in base 9).

Original entry on oeis.org

2, 3, 5, 7, 12, 25, 32, 45, 47, 52, 65, 67, 87, 212, 232, 267, 287, 425, 432, 447, 465, 625, 667, 812, 832, 847, 867, 887, 2287, 2432, 4212, 4465, 4667, 4832, 4847, 4887, 6212, 6267, 6425, 6832, 6887, 8287, 8447, 8667, 8812, 22287, 24465, 24847, 26212, 26887
Offset: 1

Views

Author

Keywords

Comments

The final term of the sequence is a(108) = 4284484465.

Crossrefs

Programs

  • Maple
    a:=[[2],[3],[5],[7]]: l1:=1: l2:=4: do for k from 1 to 8 do for j from l1 to l2 do d:=[op(a[j]),k]: if(isprime(op(convert(d, base, 9, 9^nops(d)))))then a:=[op(a), d]: fi: od: od: l1:=l2+1: l2:=nops(a): if(l1>l2)then break: fi: od: seq(op(convert(a[j], base, 10, 10^nops(a[j]))), j=1..nops(a)); # Nathaniel Johnston, Jun 21 2011
  • Python
    from sympy import isprime
    def afull():
        prime9strings, alst = list("2357"), []
        while len(prime9strings) > 0:
            alst.extend(sorted(int(p) for p in prime9strings))
            candidates = set(d+p for p in prime9strings for d in "12345678")
            prime9strings = [c for c in candidates if isprime(int(c, 9))]
        return alst
    print(afull()) # Michael S. Branicky, Apr 27 2022

A024779 Every suffix is prime and contains no 0 digits in base 4 (written in base 4).

Original entry on oeis.org

2, 3, 13, 23, 113, 223, 323, 1223, 2113, 3323, 21223, 32113, 33323, 233323, 321223, 333323
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Python
    from sympy import isprime
    def afull():
        prime_strings, alst = list("23"), []
        while len(prime_strings) > 0:
            alst.extend(sorted(int(p) for p in prime_strings))
            candidates = set(d+p for p in prime_strings for d in "123")
            prime_strings = [c for c in candidates if isprime(int(c, 4))]
        return alst
    print(afull()) # Michael S. Branicky, Apr 27 2022

A024780 Every suffix prime and no 0 digits in base 5 (written in base 5).

Original entry on oeis.org

2, 3, 12, 23, 32, 43, 232, 243, 412, 423, 2232, 4412, 4423, 22232, 222232
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Python
    from sympy import isprime
    def afull():
        prime_strings, alst = list("23"), []
        while len(prime_strings) > 0:
            alst.extend(sorted(int(p) for p in prime_strings))
            candidates = set(d+p for p in prime_strings for d in "1234")
            prime_strings = [c for c in candidates if isprime(int(c, 5))]
        return alst
    print(afull()) # Michael S. Branicky, Apr 27 2022

A024782 Every suffix prime and no 0 digits in base 7 (written in base 7).

Original entry on oeis.org

2, 3, 5, 23, 25, 32, 43, 52, 65, 443, 452, 623, 625, 632, 652, 2452, 2623, 6625, 6652, 42623, 642623, 6642623
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    a:=[[2], [3], [5]]: b:=[]: l1:=1: l2:=3: do for k from 1 to 6 do for j from l1 to l2 do d:=[op(a[j]),k]: if(isprime(op(convert(d, base, 7, 7^nops(d)))))then a:=[op(a), d]: fi: od: od: l1:=l2+1: l2:=nops(a): if(l1>l2)then break: fi: od: seq(op(convert(a[j], base, 10, 10^nops(a[j]))), j=1..nops(a)); # Nathaniel Johnston, Jun 21 2011
  • Python
    from sympy import isprime
    def afull():
        prime_strings, alst = list("235"), []
        while len(prime_strings) > 0:
            alst.extend(sorted(int(p) for p in prime_strings))
            candidates = set(d+p for p in prime_strings for d in "123456")
            prime_strings = [c for c in candidates if isprime(int(c, 7))]
        return alst
    print(afull()) # Michael S. Branicky, Apr 27 2022

A077390 Primes which leave primes at every step if most significant digit and least significant digit are deleted until a one digit or two digit prime is obtained.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 127, 131, 137, 139, 151, 157, 173, 179, 223, 227, 229, 233, 239, 251, 257, 271, 277, 331, 337, 353, 359, 373, 379, 421, 431, 433, 439, 457, 479, 521, 523, 557, 571, 577, 631, 653, 659
Offset: 1

Views

Author

Amarnath Murthy, Nov 07 2002

Keywords

Comments

There are exactly 920720315 such primes, the largest being 9161759674286961988443272139114537477768682563429152377117139 1111313737919133977331737137933773713713973. - Karl W. Heuer, Apr 19 2011
There are exactly 331780864 odd length primes and 588939451 even length primes, the largest odd length prime being
7228828176786792552781668926755667258635743361825711373791931117197999133917737137399993737111177. - Seth A. Troisi, May 07 2019
Zeros are not permitted, otherwise this sequence would potentially be infinite (cf. A077391). - Sean A. Irvine, May 19 2025

Examples

			21313 is a member as 21313, 131 and 3 all are primes.
		

Crossrefs

Cf. A024770 (right-truncatable primes), A024785 (left-truncatable primes), A137812 (left-or-right truncatable primes).
Cf. A077391.

Programs

  • Mathematica
    msd={1,2,3,4,5,6,7,8,9}; lsd={1,3,7,9}; Clear[p]; p[1]={2,3,5,7}; p[2]={11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97}; p[digits_] := p[digits] = Select[Flatten[Outer[Plus, 10^(digits-1)*msd, 10*p[digits-2], lsd]], PrimeQ]; t={}; k=0; While[Length[t] < 100, k++; t=Join[t, p[k]]]; t (* T. D. Noe, Apr 19 2011 *)
    paesQ[n_]:=AllTrue[NestWhileList[FromDigits[Most[Rest[ IntegerDigits[ #]]]]&, n,#>99&],PrimeQ]; Select[Prime[Range[150]],paesQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Feb 01 2015 *)
  • Python
    from itertools import count, islice
    from sympy import isprime, primerange
    def agen(): # generator of terms
        odds, evens, digits = [2, 3, 5, 7], list(primerange(10, 100)), 3
        yield from odds + evens
        while len(odds) > 0 or len(evens) > 0:
            new = []
            old = odds if digits%2 == 1 else evens
            for first in "123456789":
                for p in old:
                    mid = str(p)
                    for last in "1379":
                        t = int(first + mid + last)
                        if isprime(t):
                            yield t
                            new.append(t)
            old = new
            if digits%2: odds = old
            else: evens = old
            print("...", digits, time()-time0)
            digits += 1
    print(list(islice(agen(), 80))) # Michael S. Branicky, May 06 2022

Extensions

Corrected and extended by T. D. Noe, Apr 19 2011
Previous Showing 11-20 of 45 results. Next