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

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).

A272106 Absolute primes in base 3: every permutation of digits in base 3 is a prime (only the smallest representatives of the permutation classes are shown).

Original entry on oeis.org

2, 5, 13, 1093, 797161, 3754733257489862401973357979128773, 6957596529882152968992225251835887181478451547013
Offset: 1

Views

Author

Chai Wah Wu, Apr 20 2016

Keywords

Comments

For n <= 7, only a(2) = 5 is not a repunit in base 3. Supersequence of A076481. Base 3 analog of A258706.

Crossrefs

A258778 Least base b >= 2 such that prime(n) is an absolute prime in base b.

Original entry on oeis.org

3, 2, 3, 2, 5, 3, 5, 5, 4, 4, 2, 7, 7, 6, 7, 4, 8, 8, 9, 6, 8, 9, 11, 7, 7, 9, 11, 11, 13, 10, 2, 10, 12, 11, 13, 17, 12, 11, 12, 9, 16, 9, 6, 13, 15, 10, 6, 11, 19, 12, 19, 13, 11, 16, 7, 17, 19, 19, 12, 7, 16, 19, 7, 10, 13, 19, 22, 7, 19, 19, 18, 18, 21, 10
Offset: 1

Views

Author

Chai Wah Wu, Jun 11 2015

Keywords

Comments

a(n) < prime(n) for n > 1. This is true since prime(n) in base prime(n)-1 is written as 11 which is an absolute prime.
Conjecture: a(n) < prime(n)-1 for n > 2.

Examples

			a(78) = 13. prime(78) = 397 in base 10 and 397_10 = 247_13. Rearranging the digits in base 13, we get 274_13 = 433_10, 427_13 = 709_10, 472_13 = 769_10, 724_13 = 1213_10, 742_13 = 1237_10, all of which are prime.
		

Crossrefs

A258802 Least base b >= 2 such that prime(n) is an absolute prime in base b with at least 2 distinct digits or 0 if no such base exists.

Original entry on oeis.org

0, 0, 3, 3, 5, 4, 5, 5, 4, 4, 6, 7, 7, 7, 7, 4, 8, 8, 9, 6, 9, 9, 11, 7, 7, 9, 11, 11, 13, 10, 13, 10, 12, 11, 13, 17, 14, 11, 12, 9, 16, 9, 6, 13, 15, 10, 6, 11, 19, 12, 19, 13, 11, 16, 7, 17, 19, 19, 12, 7, 16, 19, 7, 10, 13, 19, 22, 7, 19, 19, 18, 18, 21, 10
Offset: 1

Views

Author

Chai Wah Wu, Jun 11 2015

Keywords

Comments

a(n) < prime(n)-1. This is true since prime(n) in base b > prime(n) has a single digit, prime(n) in base prime(n) is written as 10 which is not an absolute prime and prime(n) in base prime(n)-1 is written as 11 which does not have 2 distinct digits.
For 1 <= n <= 10000, A258778 differs from A258802 for 50 values of n.
Conjecture: a(n) = 0 if and only if n=1 or n=2.

Examples

			See example in A258778.
		

Crossrefs

A263499 Numbers with nondecreasing digits such that every cyclic shift is a prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 37, 79, 113, 199, 337, 3779, 1111111111111111111, 11111111111111111111111
Offset: 1

Views

Author

Chai Wah Wu, Nov 11 2015

Keywords

Comments

a(16) is too big to display, see the b-file.
a(n) is the intersection of the sequences A068652 and A009994. A258706 is a subsequence. Up until a(16) only the term 3779 is missing from A258706.

Crossrefs

Programs

  • Mathematica
    fQ[n_] := Block[{d = IntegerDigits@ n}, And[d == Sort@ d, And @@ Table[PrimeQ@ FromDigits[d = RotateLeft@ d], {Length[d] - 1}]]]; Select[
    Prime@ Range@ 600, fQ] (* Michael De Vlieger, Nov 12 2015, after T. D. Noe at A068652 *)

A268812 Absolute primes in base 16: every permutation of digits in base 16 is a prime (only the smallest representatives of the permutation classes are shown).

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 23, 31, 53, 59, 61, 89, 191, 277, 283, 887, 1373, 1979, 3037
Offset: 1

Views

Author

Chai Wah Wu, Apr 20 2016

Keywords

Comments

Base 16 analog of A258706.

Crossrefs

A272107 Absolute primes in base 8: every permutation of digits in base 8 is a prime (only the smallest representatives of the permutation classes are shown).

Original entry on oeis.org

2, 3, 5, 7, 13, 29, 31, 47, 73, 1759
Offset: 1

Views

Author

Chai Wah Wu, Apr 20 2016

Keywords

Comments

Base 8 analog of A258706.

Crossrefs

A317689 Largest nonrepunit base-n absolute prime (conjectured).

Original entry on oeis.org

7, 53, 3121, 211, 1999, 3803, 6469, 991, 161047, 19793, 16477, 24907, 683437, 3547, 67853, 80273, 94109, 72421
Offset: 3

Views

Author

Felix Fröhlich, Aug 04 2018

Keywords

Comments

A base-b permutable or absolute prime is a prime p such that all numbers obtained from every permutation of the base-b digits of p and converted to base 10 are prime.
These primes were found using lim=10^8 in the PARI program and match those found with lim=10^5, lim=10^6 and lim=10^7. Therefore I conjecture that they are the correct values for those n.

Crossrefs

Programs

  • PARI
    find_index_a(vec) = my(r=#vec-1); while(1, if(vec[r] < vec[r+1], return(r)); r--; if(r==0, return(-1)))
    find_index_b(r, vec) = my(s=#vec); while(1, if(vec[r] < vec[s], return(s)); s--; if(s==r, return(-1)))
    switch_elements(vec, firstpos, secondpos) = my(g); g=vec[secondpos]; vec[secondpos]=vec[firstpos]; vec[firstpos] = g; vec
    reverse_order(vec, r) = my(v=[], w=[]); for(x=1, r, v=concat(v, vec[x])); for(y=r+1, #vec, w=concat(w, vec[y])); w=Vecrev(w); concat(v, w)
    next_permutation(vec) = my(r=find_index_a(vec)); if(r==-1, return(0), my(s=find_index_b(r, vec)); vec=switch_elements(vec, r, s); vec=reverse_order(vec, r)); vec
    decimal(v, base) = my(w=[]); for(k=0, #v-1, w=concat(w, v[#v-k]*base^k)); sum(i=1, #w, w[i])
    is_absolute_prime(n, base) = my(db=vecsort(digits(n, base))); if(vecmin(db)==0 || vecmax(db)==1, return(0)); while(1, my(dec=decimal(db, base)); if(!ispseudoprime(dec), return(0)); db=next_permutation(db); if(db==0, return(1)))
    a(n) = my(absp=0, lim=10^7, i=0); forprime(p=n+1, , if(is_absolute_prime(p, n), absp=p); i++; if(i==lim, return(absp)))
Showing 1-8 of 8 results.