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-10 of 16 results. Next

A024770 Right-truncatable primes: every prefix is prime.

Original entry on oeis.org

2, 3, 5, 7, 23, 29, 31, 37, 53, 59, 71, 73, 79, 233, 239, 293, 311, 313, 317, 373, 379, 593, 599, 719, 733, 739, 797, 2333, 2339, 2393, 2399, 2939, 3119, 3137, 3733, 3739, 3793, 3797, 5939, 7193, 7331, 7333, 7393, 23333, 23339, 23399, 23993, 29399, 31193
Offset: 1

Views

Author

Keywords

Comments

Primes in which repeatedly deleting the least significant digit gives a prime at every step until a single-digit prime remains. The sequence ends at a(83) = 73939133 = A023107(10).
The subsequence which consists of the following "chain" of consecutive right truncatable primes: 73939133, 7393913, 739391, 73939, 7393, 739, 73, 7 yields the largest sum, compared with other chains formed from subsets of this sequence: 73939133 + 7393913 + 739391 + 73939 + 7393 + 739 + 73 + 7 = 82154588. - Alexander R. Povolotsky, Jan 22 2008
Can also be seen as a table whose n-th row lists the n-digit terms; row lengths (0 for n >= 9) are given by A050986. The sequence can be constructed starting with the single-digit primes and appending, for each p in the list, the primes within 10*p and 10(p+1), formed by appending a digit to p. - M. F. Hasler, Nov 07 2018

References

  • Roozbeh Hazrat, Mathematica: A Problem-Centered Approach, Springer London 2010, pp. 86-89.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 112-113.

Crossrefs

Supersequence of A085823, A202263. Subsequence of A012883, A068669. - Jaroslav Krizek, Jan 28 2012
Supersequence of A239747.
Cf. A033664, A024785 (left-truncatable primes), A032437, A020994, A052023, A052024, A052025, A050986, A050987, A069866, A077390 (left-and-right-truncatable primes), A137812 (left-or-right truncatable primes), A254751, A254753.
Cf. A237600 for the base-16 analog.

Programs

  • Haskell
    import Data.List (inits)
    a024770 n = a024770_list !! (n-1)
    a024770_list = filter (\x ->
       all (== 1) $ map (a010051 . read) $ tail $ inits $ show x) a038618_list
    -- Reinhard Zumkeller, Nov 01 2011
    
  • Maple
    s:=[1,3,7,9]: a:=[[2],[3],[5],[7]]: l1:=1: l2:=4: do for j from l1 to l2 do for k from 1 to 4 do d:=[s[k],op(a[j])]: if(isprime(op(convert(d, base, 10, 10^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
  • Mathematica
    max = 100000; truncate[p_] := If[PrimeQ[q = Quotient[p, 10]], q, p]; ok[p_] := FixedPoint[ truncate, p] < 10; p = 1; A024770 = {}; While[ (p = NextPrime[p]) < max, If[ok[p], AppendTo[ A024770, p]]]; A024770 (* Jean-François Alcover, Nov 09 2011, after Pari *)
    eppQ[n_]:=AllTrue[FromDigits/@Table[Take[IntegerDigits[n],i],{i, IntegerLength[ n]-1}], PrimeQ]; Select[Prime[Range[3400]],eppQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jan 14 2015 *)
  • PARI
    {fileO="b024770.txt";v=vector(100);v[1]=2;v[2]=3;v[3]=5;v[4]=7;j=4;j1=1; write(fileO,"1 2");write(fileO,"2 3");write(fileO,"3 5");write(fileO,"4 7"); until(0,if(j1>j,break);new=1;for(i=j1,j,if(new,j1=j+1;new=0);for(k=1,9, z=10*v[i]+k;if(isprime(z),j++;v[j]=z;write(fileO,j," ",z);))));} \\ Harry J. Smith, Sep 20 2008
    
  • PARI
    for(n=2, 31193, v=n; while(isprime(n), c=n; n=(c-lift(Mod(c, 10)))/10); if(n==0, print1(v, ", ")); n=v); \\ Arkadiusz Wesolowski, Mar 20 2014
    
  • PARI
    A024770=vector(9, n, p=concat(apply(t->primes([t, t+1]*10), if(n>1, p)))) \\ The list of n-digit terms, 1 <= n <= 9. Use concat(%) to "flatten" it. - M. F. Hasler, Nov 07 2018
    
  • Python
    from sympy import primerange
    p = lambda x: list(primerange(x, x+10)); A024770 = p(0); i=0
    while iA024770): A024770+=p(A024770[i]*10); i+=1 # M. F. Hasler, Mar 11 2020

A003459 Absolute primes (or permutable primes): every permutation of the digits is a prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 113, 131, 199, 311, 337, 373, 733, 919, 991, 1111111111111111111, 11111111111111111111111
Offset: 1

Views

Author

Keywords

Comments

From Bill Gosper, Jan 24 2003, in a posting to the Math Fun Mailing List: (Start)
Recall Sloane's old request for more terms of A003459 = (2 3 5 7 11 13 17 31 37 71 73 79 97 113 131 199 311 337 373 733 919 991 ...) and Richard C. Schroeppel's astonishing observation that the next term is 1111111111111111111. Absent Rich's analysis, trying to extend this sequence makes a great set of beginner's programming exercises. We may restrict the search to combinations of the four digits 1,3,7,9, only look at starting numbers with nondecreasing digits, generate only unique digit combinations, and only as needed. (We get the target sequence afterward by generating and merging the various permutations, and fudging the initial 2,3,5,7.)
To my amazement the (uncompiled, Macsyma) program printed 11,13,...,199,337, and after about a minute, 1111111111111111111!
And after a few more minutes, (10^23-1)/9! (End)
Boal and Bevis say that Johnson (1977) proves that if there is a term > 1000 with exactly two distinct digits then it must have more than nine billion digits. - N. J. A. Sloane, Jun 06 2015
Some authors require permutable or absolute primes to have at least two different digits. This produces the subsequence A129338. - M. F. Hasler, Mar 26 2008
See A039986 for a related problem with more sophisticated (PARI) code (iteration over only inequivalent digit permutations). - M. F. Hasler, Jul 10 2018

References

  • Richard C. Schroeppel, personal communication.
  • Wacław Sierpiński, Co wiemy, a czego nie wiemy o liczbach pierwszych. Warsaw: PZWS, 1961, pp. 20-21.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 113.

Crossrefs

Includes all of A004022 = A002275(A004023).
A258706 gives minimal representatives of the permutation classes.
Cf. A039986.

Programs

  • Haskell
    import Data.List (permutations)
    a003459 n = a003459_list !! (n-1)
    a003459_list = filter isAbsPrime a000040_list where
       isAbsPrime = all (== 1) . map (a010051 . read) . permutations . show
    -- Reinhard Zumkeller, Sep 15 2011
    
  • Mathematica
    f[n_]:=Module[{b=Permutations[IntegerDigits[n]],q=1},Do[If[!PrimeQ[c=FromDigits[b[[m]]]],q=0;Break[]],{m,Length[b]}];q];Select[Range[1000],f[#]>0&] (* Vladimir Joseph Stephan Orlovsky, Feb 03 2011 *)
    (* Linear complexity: can't reach R(19). See A258706. - Bill Gosper, Jan 06 2017 *)
  • PARI
    for(n=1, oo, my(S=[],r=10^n\9); for(a=1, 9^(n>1), for(b=if(n>2, 1-a), 9-a, for(j=0, if(b, n-1), ispseudoprime(a*r+b*10^j)||next(2)); S=concat(S,vector(if(b,n,1),k,a*r+10^(k-1)*b))));apply(t->printf(t","),Set(S))) \\ M. F. Hasler, Jun 26 2018

Formula

Conjecture: for n >= 23, a(n) = A004022(n-21). - Max Alekseyev, Oct 08 2018

Extensions

The next terms are a(25)=A002275(317), a(26)=A002275(1031), a(27)=A002275(49081).

A237600 Right-truncatable primes in base 16.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 37, 41, 43, 47, 53, 59, 61, 83, 89, 113, 127, 179, 181, 191, 211, 223, 593, 599, 601, 607, 659, 661, 691, 701, 757, 761, 853, 857, 859, 863, 947, 953, 977, 983, 991, 1427, 1429, 1433, 1439, 1811, 1823, 2039, 2879, 2897, 2903, 2909, 3061
Offset: 1

Views

Author

Stanislav Sykora, Feb 15 2014

Keywords

Comments

Numbers with these properties: (i) a(n) is a prime and (ii) its image under the function E(k) = k\16 = floor(k/16) is zero or has the same properties. [Corrected by M. F. Hasler, Nov 07 2018]
The sequence has 414 nonzero members.
Otherwise said, integers p > 0 such that floor(p/16^k) is prime or zero for all k >= 0. One might relax to p >= 0, i.e., include an initial term 0, corresponding to an empty string of digits. The recursive definition can also be used to produce all of the terms, starting with the primes < 16, and adding, for each term of the list, the primes made from appending a digit to that term, i.e., the primes between 16 x that term and 16 more. The sequence can also be seen as a table whose n-th row yields the terms with n digits in base 16: row lengths are A237601 and the last term of row n is A237602(n). - M. F. Hasler, Nov 07 2018

Examples

			a(414) = 16778492037124607, in hexadecimal notation 3B9BF319BD51FF, belongs to a(n) because each of its hexadecimal prefixes (including itself) is a prime. Being the largest of such numbers, it is also a member of A023107.
		

Crossrefs

Programs

  • Mathematica
    Select[Range@ 3600, AllTrue[Most[DeleteDuplicates@ FixedPointList[f, #]], PrimeQ] &] (* Michael De Vlieger, Mar 07 2015, Version 10 *)
  • PARI
    GT_Trunc1(nmax,prop,b=10) = { \\ See the link for details
      my (n=0,v=vector(nmax),g=1,lgs=1,lge,an,c);
      for (k=1,b-1,if (prop(k),v[n++]=k));
      lge=n; c=lge-lgs+1;
      while (c, g++;for (k=lgs,lge,for (m=0,b-1, an=b*v[k]+m;
        if (prop(an), v[n++]=an;if (n>=nmax,return (v)));););
        lgs=lge+1; lge=n; c=lge-lgs+1;);
      if (n, return (v[1..n]));
      print("No solution");}
    v = GT_Trunc1(1000000,isprime,16)
    
  • PARI
    isok(n)={ while(n, if(!isprime(n),return(0));n\=16); 1} \\ Joerg Arndt, Mar 07 2015
    
  • PARI
    my(A=primes([0,15]),i=1); until(#AA237600=A \\ M. F. Hasler, Nov 07 2018
    
  • Python
    from gmpy2 import is_prime
    A237600_list = []
    for n in range(1,10**9):
        if is_prime(n):
            s = format(n,'x')
            for i in range(1,len(s)):
                if not is_prime(int(s[:-i],16)):
                    break
            else:
                A237600_list.append(n) # Chai Wah Wu, Apr 16 2015
    
  • Python
    from sympy import primerange
    p = lambda x: list(primerange(x,x+16)); A237600 = p(0); i=0
    while iA237600): A237600+=p(A237600[i]*16); i+=1 # M. F. Hasler, Mar 11 2020

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.

A103443 Largest left-truncatable prime in base n (decimal expansion).

Original entry on oeis.org

23, 4091, 7817, 4836525320399, 817337, 14005650767869, 1676456897, 357686312646216567629137, 2276005673, 13092430647736190817303130065827539, 812751503, 615419590422100474355767356763
Offset: 3

Views

Author

Martin Renner, Mar 21 2005, Sep 24 2007, Apr 20 2008

Keywords

Crossrefs

Programs

  • PARI
    a(n)=my(v=primes(primepi(n-1)),u,t,b=1,best); while(#v, best=vecmax(v); b*=n; u=List(); for(i=1,#v,for(k=1,n-1,if(isprime(t=v[i]+k*b), listput(u,t)))); v=Vec(u)); best \\ Charles R Greathouse IV, Feb 05 2013

Extensions

Base-14 entry corrected by Hans Havermann, May 30 2011
Corresponding entry in a-file corrected by N. J. A. Sloane, Jun 02 2011
a-file corrected and expanded by Hans Havermann, Jan 25 2014

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.

A238854 Largest right-truncatable, reversible prime in base n.

Original entry on oeis.org

23, 53, 449, 191, 1171, 30671, 5827, 3733, 901687, 10357, 834469, 3043427, 5430889, 4060019, 498061, 34763, 118248433, 62344463, 218555173, 4463351, 114607657, 7903613, 14523874693, 211675817, 32814697, 93375223, 162466979, 8052409793, 12006877873
Offset: 3

Views

Author

Stanislav Sykora, Mar 07 2014

Keywords

Comments

See A238850, A238851, A238852, A238853 for the finite lists of such numbers in four bases selected as examples. A sequence conceptually similar to this one, but for right-truncatable (not reversible!) primes is A023107. The present, more restrictive, condition leads to smaller numbers which can be evaluated in reasonable time for much higher n values.

Examples

			a(4) = 53 because it is a prime which in base 4 reads 311_b4, its reverse 113_b4 (decimal 23) is also a prime, the same holds for all its base-4 prefixes (31_b4 and 3_b4), and it is the largest natural having these properties.
		

Crossrefs

Cf. Full in base 10: A238850, 16: A238851, 100: A238852, 256: A238853.
Cf. In base n: A238855 (totals), A238856 (maximum digits), A238857 (m-digits counts).

Programs

  • PARI
    See the link.

A238855 Number of all right-truncatable reversible primes in base n.

Original entry on oeis.org

0, 3, 4, 12, 5, 12, 24, 17, 16, 33, 22, 29, 50, 39, 40, 39, 24, 65, 80, 100, 58, 58, 69, 122, 101, 90, 83, 125, 114, 133, 114, 122, 255, 203, 252, 123, 152, 221, 202, 308, 131, 250, 299, 397, 303, 143, 201, 484, 497, 423, 269, 253, 442, 944, 845, 378, 231, 460, 420, 455, 538, 438
Offset: 2

Views

Author

Stanislav Sykora, Mar 07 2014

Keywords

Comments

For definitions and more comments, see A238854 and A238850.
Conjecture: in any base n, the number of right-truncatable reversible primes is finite.

Examples

			In bases 10, 16, 100, and 256 (used as examples in the crossrefs) there are, respectively, 16, 40, 1552, and 35127 such numbers.
		

Crossrefs

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

Programs

  • PARI
    See the link.

A238856 Number of digits of the largest right-truncatable reversible prime in base n.

Original entry on oeis.org

0, 3, 3, 4, 3, 4, 5, 4, 4, 6, 4, 6, 6, 6, 6, 5, 4, 7, 6, 7, 5, 6, 5, 8, 6, 6, 6, 6, 7, 7, 6, 6, 8, 6, 8, 7, 8, 8, 7, 8, 7, 8, 8, 8, 8, 7, 7, 9, 9, 8, 7, 8, 10, 10, 9, 8, 6, 9, 8, 7, 9, 9, 9, 9, 11, 8, 7, 9, 10, 9, 10, 9, 9, 11, 10, 10, 9, 9, 8, 9, 9, 8, 10, 10, 10, 9, 9, 9, 10, 11
Offset: 2

Views

Author

Stanislav Sykora, Mar 13 2014

Keywords

Comments

For definitions and more comments, see A238854 and A238850. A weak conjecture: this sequence might be bounded.

Examples

			a(16) = 6 because the largest truncatable reversible prime in base 16 has 6 hexadecimal digits (see A238851).
		

Crossrefs

Cf. Full in base 10: A238850, 16: A238851, 100: A238852, 256: A238853.
Cf. In base n: A238854 (largest), A238855 (totals), A238857 (m-digit counts).

Programs

  • PARI
    See the link.

A238857 Array read by rows: row n lists total number of m-digit right-truncatable reversible primes in base n.

Original entry on oeis.org

0, 1, 1, 1, 0, 2, 1, 1, 0, 2, 4, 4, 2, 0, 3, 1, 1, 0, 3, 5, 3, 1, 0, 4, 7, 7, 5, 1, 0, 4, 5, 5, 3, 0, 4, 5, 6, 1, 0, 4, 8, 7, 9, 4, 1, 0, 5, 5, 7, 5, 0, 5, 10, 8, 4, 1, 1, 0, 6, 11, 17, 12, 3, 1, 0, 6, 11, 13, 6, 2, 1, 0, 6, 9, 11, 9, 4, 1, 0, 6, 13, 12, 7, 1, 0, 7, 9, 7, 1, 0
Offset: 2

Views

Author

Stanislav Sykora, Mar 13 2014

Keywords

Comments

For definitions and more comments, see A238854 and A238850.
This is an irregular table with one line for every base, starting at 2, while the columns correspond to the number of digits (1,2,3,...). Each row terminates with a zero (in any given base there appears to be a finite number of instances).

Examples

			These are the first rows of the table:
   2: 0,
   3: 1, 1, 1, 0,
   4: 2, 1, 1, 0,
   5: 2, 4, 4, 2, 0,
   6: 3, 1, 1, 0,
   7: 3, 5, 3, 1, 0,
   8: 4, 7, 7, 5, 1, 0,
   9: 4, 5, 5, 3, 0,
  10: 4, 5, 6, 1, 0,
  ...
Hence, there are 6 right truncatable reversible primes with 3 digits in base 10 (see A238850).
		

Crossrefs

Full in base 10: A238850, 16: A238851, 100: A238852, 256: A238853.
In base n: A238854 (largest), A238855 (totals), A238856 (maximum digits).

Programs

  • PARI
    See the link.
Showing 1-10 of 16 results. Next