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 56 results. Next

A032437 Substrings from the right are prime numbers (using only odd digits different from 5).

Original entry on oeis.org

3, 7, 13, 17, 37, 73, 97, 113, 137, 173, 197, 313, 317, 337, 373, 397, 773, 797, 937, 997, 1373, 1997, 3137, 3313, 3373, 3797, 7937, 9137, 9173, 9337, 9397, 13313, 33797, 39397, 79337, 79397, 91373, 91997, 99137, 99173, 99397, 139397, 379397
Offset: 1

Views

Author

Keywords

Comments

Primes p with decimal expansion d_1 d_2 d_3 ... d_k such that the digits d_i are 1, 3, 7, or 9, and deleting 1, 2, 3, up to k-1 leading digits also produces a prime. For example, 9173 is a term because all of 9173, 173, 73, and 3 are primes. - N. J. A. Sloane, Jun 28 2022

Examples

			173 is a term because 173, 73, and 3 are all primes. 371 is not a term because 371 and 1 are not primes. - _N. J. A. Sloane_, Jun 28 2022
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[33000]],SubsetQ[{1,3,7,9},IntegerDigits[#]]&&AllTrue[Mod[#,10^Range[ IntegerLength[ #]-1]],PrimeQ]&] (* Harvey P. Dale, Jun 28 2022 *)
  • PARI
    is(n)=my(d=digits(n)); for(i=1,n, if(!isprime(fromdigits(d[i..n])), return(0))); 1 \\ Charles R Greathouse IV, Jun 25 2017

Extensions

Single-digit terms added by Eric W. Weisstein.

A052023 Every suffix of palindromic prime a(n), containing no '0' digit, is prime (left-truncatable palindromic primes).

Original entry on oeis.org

2, 3, 5, 7, 313, 353, 373, 383, 797, 76367, 79397, 7693967, 799636997
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    d[n_]:=IntegerDigits[n]; ltrQ[n_]:=And@@PrimeQ[NestList[FromDigits[Drop[d[#],1]]&,n,Length[d[n]]-1]]; palQ[n_]:=Reverse[x=d[n]]==x; Select[Prime[Range[540000]],palQ[#]&<rQ[#]&] (* Jayanta Basu, Jun 02 2013 *)

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

A238853 Right-truncatable, reversible primes in base 256.

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, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 773, 809, 823
Offset: 1

Views

Author

Stanislav Sykora, Mar 06 2014

Keywords

Comments

See A238850 for definitions, and A238854 for comments on general context.
In base 256, there are 35127 such numbers (see A238855), shown here in decimal format. Base 256 is of interest to programmers because its digits correspond to 8-bit bytes and are easily readable in hexadecimal.

Examples

			The largest such number is 143496996325262301365903209731563 which, written in hex format, with hyphens between bytes for better readability, is 07-13-2F-CD-51-E1-B1-11-EB-23-CD-B3-15-EB. Truncate on the right any number of bytes and the remaining prefix is still a prime, no matter whether the bytes are read from left to right, or vice versa!
		

Crossrefs

Cf. All in base 10: A238850, 16: A238851, 100: A238852.
Cf. In base n: A238854 (largest), A238856 (maximum digits), A238857 (m-digits counts). Cf. A007500, A023107, A024770, A237600, A237601, A237602.

Programs

  • PARI
    See the link.

A202259 Right-truncatable nonprimes: every prefix is nonprime number.

Original entry on oeis.org

0, 1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 40, 42, 44, 45, 46, 48, 49, 60, 62, 63, 64, 65, 66, 68, 69, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 98, 99, 100, 102, 104, 105, 106, 108, 120, 121, 122, 123, 124, 125, 126, 128, 129, 140, 141, 142
Offset: 1

Views

Author

Jaroslav Krizek, Dec 25 2011

Keywords

Comments

Supersequence of A202260, A202265. - Barry Carter, Sep 16 2016

Crossrefs

Cf. A012883 (right-truncatable noncomposites), A024770 (right-truncatable primes), A202260 (right-truncatable composites).

Programs

  • Maple
    filter:= proc(n) option remember; not isprime(n) and procname(floor(n/10)) end proc:
    for i from 0 to 9 do filter(i):= not isprime(i) od:
    select(filter, [$0..1000]); # Robert Israel, Nov 01 2016

A227919 Primes which remain prime when rightmost digit is removed.

Original entry on oeis.org

23, 29, 31, 37, 53, 59, 71, 73, 79, 113, 131, 137, 139, 173, 179, 191, 193, 197, 199, 233, 239, 293, 311, 313, 317, 373, 379, 419, 431, 433, 439, 479, 593, 599, 613, 617, 619, 673, 677, 719, 733, 739, 797, 839, 971, 977, 1013, 1019, 1031, 1033, 1039, 1091, 1093
Offset: 1

Views

Author

K. D. Bajpai, Oct 10 2013

Keywords

Comments

After a(2), all the terms in this sequence have second digit from right 1, 3, 7, or 9.

Examples

			a(7)= 71 which is prime. Removing the rightmost digit gives 7, which is also prime.
a(16)= 191 which is prime. Removing the rightmost digit gives 19, which is also prime.
		

Crossrefs

Cf. A000040 (prime numbers), A024770 (right-truncatable primes).
Cf. A052025 (palindromic prime is prime right- or left-truncatable).
Cf. A137812 (left- or right-truncatable primes).

Programs

  • Maple
    KD:= proc() local a,b; a:= ithprime(n); b:=floor(a/10); if isprime(b) then return (a) :fi; end: seq(KD(),n=1..1000);
  • PARI
    is(n)=isprime(n) && isprime(n\10) \\ Charles R Greathouse IV, Oct 12 2013

A012883 Numbers in which every prefix (in base 10) is 1 or a prime.

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 53, 59, 71, 73, 79, 113, 131, 137, 139, 173, 179, 191, 193, 197, 199, 233, 239, 293, 311, 313, 317, 373, 379, 593, 599, 719, 733, 739, 797, 1319, 1373, 1399, 1733, 1913, 1931, 1933, 1973, 1979, 1993, 1997, 1999
Offset: 1

Views

Author

Larry Calmer (larry(AT)wri.com), Simon Plouffe

Keywords

Crossrefs

Cf. A024770 (every prefix is prime).

Programs

  • Mathematica
    max = 10^10; truncate[p_] := If[q = Quotient[p, 10]; q == 1 || PrimeQ[q], q, p]; ok[p_] := FixedPoint[truncate, p] < 10; p = 1; cnt = 2; A012883 = Join[{1}, Reap[While[(p = NextPrime[p]) < max, If[ok[p], Print[cnt++, " ", p]; Sow[p]]]][[2, 1]]] (* Jean-François Alcover, Nov 23 2015 *)
  • PARI
    for(n=1, 1e4, k=n; while(isprime(n) || n==1, c=n; n=(c-lift(Mod(c, 10)))/10); if(n==0, print1(k, ", ")); n=k) \\ Altug Alkan, Nov 23 2015

Extensions

Last term is A094335(10) = 1979339339 (confirmed by David W. Wilson ).

A065122 a(1) = 2; a(n) is smallest prime > 10*a(n-1).

Original entry on oeis.org

2, 23, 233, 2333, 23333, 233341, 2333459, 23334601, 233346041, 2333460413, 23334604169, 233346041759, 2333460417637, 23334604176379, 233346041763823, 2333460417638239, 23334604176382489, 233346041763824911
Offset: 1

Views

Author

Henry Bottomley, Nov 13 2001

Keywords

Crossrefs

Programs

  • Mathematica
    NextPrim[n_Integer] := Block[ {k = n + 1}, While[ !PrimeQ[k], k++ ]; Return[k]]; a[1] = 2; a[n_] := NextPrim[ 10*a[n - 1]]; Table[ a[n], {n, 1, 20} ]
    NestList[NextPrime[10#]&,2,20] (* Harvey P. Dale, Jun 03 2012 *)
  • PARI
    { for (n=1, 100, if (n>1, a=nextprime(10*a), a=2); write("b065122.txt", n, " ", a) ) } \\ Harry J. Smith, Oct 10 2009

Extensions

More terms from Robert G. Wilson v, Nov 28 2001

A238852 Right-truncatable, reversible primes in base 100.

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, 311, 313, 347, 349, 353, 359, 367, 701, 709, 719, 727, 733, 739, 751, 769, 773, 787, 1103, 1109, 1123, 1163, 1181, 1193, 1301, 1303, 1319, 1321, 1327, 1361, 1777
Offset: 1

Views

Author

Stanislav Sykora, Mar 06 2014

Keywords

Comments

See A238850 for definitions, and A238854 for comments on general context.
In base 100, chosen as one of four examples, there are 1552 such numbers.

Examples

			The largest number of this type (using hyphens to separate the base 100 digits) is 19-07-93-27-17-37-99-47-19-11.Truncate any even number of decimal digits on its right, and the remaining prefix is still a base-100 reversible prime (e.g., 19079327 and 27930719 are both primes).
		

Crossrefs

Cf. All in base 10: A238850, 16: A238851, 256: A238853.
Cf. In base n: A238854 (largest), A238855 (totals), A238856 (maximum digits), A238857 (m-digit counts).

Programs

  • PARI
    See the link.
Previous Showing 11-20 of 56 results. Next