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.

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

A096599 Squares k^2 with property that A062892(k^2) = 1.

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 121, 225, 289, 324, 361, 484, 529, 576, 676, 729, 784, 841, 1156, 1225, 1444, 1521, 1681, 1849, 2116, 2209, 2601, 2704, 3025, 3136, 3249, 3364, 3481, 3721, 3844, 3969, 4225, 4356, 4489, 4624, 5041, 5184, 5329, 5476
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 29 2004

Keywords

Crossrefs

Programs

  • Python
    from math import isqrt
    from sympy.utilities.iterables import multiset_permutations as mp
    def sqr(n): return isqrt(n)**2 == n
    def ok(square):
        s = str(square)
        perms = (int("".join(p)) for p in mp(s, len(s)))
        return len(set(p for p in perms if sqr(p))) == 1
    def aupto(limit): return [k*k for k in range(isqrt(limit)+1) if ok(k*k)]
    print(aupto(5476)) # Michael S. Branicky, Oct 18 2021

Extensions

Definition clarified by N. J. A. Sloane, Jan 16 2014

A374238 Primes whose pattern of identical digits is unique among the primes.

Original entry on oeis.org

11, 3333311, 7771717, 11818181, 515115551, 727722727, 887887787, 1110011101, 1161611161, 1411111441, 1411141411, 1717117117, 1911999919, 3311113111, 3313133311, 3333353533, 5151111551, 5555115151, 5777777557, 7373733337, 7747447777, 7777111777, 8887788787, 9199119991, 9994449499
Offset: 1

Views

Author

Dmytro Inosov, Jul 01 2024

Keywords

Comments

The digit pattern for any natural number n is uniquely defined by the canonical form A358497(n), which enumerates digits according to their position of first occurrence. Each prime in this sequence has a unique digit pattern in the sense that no other prime has the same pattern.
Prime repunits (A004022) are a subsequence, as they are the sole primes with a single distinct digit.
A cryptarithm (alphametic) expresses a digit pattern in letters, where each distinct letter is to map to a distinct digit.
If a cryptarithmetic problem calls for a prime number, then the primes in this sequence are unique solutions, so we call these primes cryptarithmically unique.
The smallest term with 3 distinct digits is 1151135331533311.
The number of terms of length n is given by A376084(n).

Examples

			11 is a term since no other prime has the same pattern "AA" of two identical digits (any other AA is divisible by A > 1, hence nonprime).
Counterexample: 13 is not a term since another prime 17 has the same pattern "AB" of two nonidentical digits.
7771717 is a term since it's prime and no other prime has the same pattern "AAABABA".
		

Crossrefs

Cf. A000040 (primes), A004022 (prime repunits), A358497, A039986, A376918, A376084, A376118.

Programs

  • Mathematica
    NumOfDigits = 10; (*Maximal integer length to be searched for*)
    A358497[k_] :=
      FromDigits[
       Table[Mod[
         CountDistinct[Take[#, FirstPosition[#, #[[i]]][[1]]]] &[
          IntegerDigits[k]], 10], {i, 1, IntegerLength[k]}]];
    A006880[MaxLen_] := PrimePi[10^MaxLen];
    Extract[Select[
       Tally[Table[{#, A358497[#]} &[Prime[i]], {i, 1,
           A006880[NumOfDigits]}], #1[[2]] == #2[[2]] &], #[[2]] == 1 &], {All, 1}]

A166921 Least prime with exactly n prime anagrams not equal to itself.

Original entry on oeis.org

2, 13, 113, 149, 1013, 1039, 1427, 1123, 1439, 1579, 1237, 10271, 10453, 10139, 10253, 10243, 10457, 11579, 10789, 10273, 11239, 12457, 10729, 13249, 12347, 13687, 12539, 14759, 13799, 10739, 12637, 12893, 23957, 13597, 100493, 12379, 14593, 101383, 13789
Offset: 0

Views

Author

Pierre CAMI, Oct 23 2009

Keywords

Comments

13 has only one prime anagram (31), and no smaller prime has a prime anagram other than itself, so a(1) = 13.
113 has 2 prime anagrams (131 and 311), and no smaller prime has two prime anagrams other than itself, so a(2) = 113.
149 has 3 prime anagrams (419, 491, and 941), and no smaller prime has three prime anagrams other than itself, so a(3) = 149.

Examples

			a(7) = prime 1123 with 7 prime anagrams 1213, 1231, 1321, 2113, 2131, 2311, 3121.
		

Crossrefs

Programs

  • Python
    # see link for faster version
    from sympy import isprime
    from itertools import permutations
    def anagrams(n):
      s = str(n)
      return set(int("".join(p)) for p in permutations(s) if p[0] != '0')
    def num_prime_anagrams(n): return sum(isprime(i) for i in anagrams(n))
    def a(n):
      if n == 0: return 2
      k = 3
      while not isprime(k) or num_prime_anagrams(k) != n+1: k += 2
      return k
    print([a(n) for n in range(39)]) # Michael S. Branicky, Feb 13 2021

Extensions

Definition edited and a(0) added by Chai Wah Wu, Dec 26 2016

A225421 Prime numbers consisting of only odd digits such that there is only one permutation of its digits that produces a prime number.

Original entry on oeis.org

3, 5, 7, 11, 19, 53, 59, 151, 353, 557, 599, 773, 997, 5557, 7559, 11119, 15559, 59999, 71777, 75553, 79999, 99991, 191999, 511111, 555557, 575557, 775777, 777977, 799979, 1111151, 3353333, 5595559, 5755559, 7577777, 9999991, 33335333, 55555553, 55555559
Offset: 1

Views

Author

T. D. Noe, May 07 2013

Keywords

Crossrefs

Cf. A039986 (similar, but allowing even digits also).

Programs

A364458 Prime numbers that are not repdigits with digits in nondecreasing order with the property that any nontrivial permutation of the digits gives a composite number.

Original entry on oeis.org

19, 23, 29, 47, 59, 67, 89, 223, 227, 229, 233, 257, 269, 449, 499, 557, 599, 677, 1447, 2267, 2447, 4447, 5557, 8999, 11119, 15559, 22229, 22669, 23333, 24889, 44449, 48889, 55589, 55889, 59999, 79999, 222269, 444449, 455557, 555557, 555589, 666667, 4444469, 4555559
Offset: 1

Views

Author

Jean-Marc Rebert, Dec 23 2023

Keywords

Comments

The least terms with respectively 2, 3, 4 distinct digits are 19, 257, 24889.

Examples

			19 is a term, because the digits of 19 are in nondecreasing order and 91 is the unique number != 19 given by a permutation of 19 and 91 = 7 * 13 is composite and the digits of 91 are not in nondecreasing order.
		

Crossrefs

Programs

  • PARI
    is(k)=my(u=digits(k),n=#u);if(#vecsort(u,,8)==1||u!=vecsort(u)||!isprime(k),return(0));forperm(n,p,my(vp=Vec(p),v=[]);for(i=1,n,v=concat(v,u[vp[i]]));q=fromdigits(v);if(k!=q&&isprime(q),return(0)));1
    
  • PARI
    \\ See PARI link
    
  • Python
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations as mp
    from itertools import count, islice, combinations_with_replacement as mc
    def bgen(d): yield from ("".join(m) for m in mc("123456789", d))
    def agen(): yield from (t for d in count(1) for k in bgen(d) if len(set(k))!=1 and isprime(t:=int(k)) if not any((j:="".join(m))!=k and isprime(int(j)) for m in mp(k)))
    print(list(islice(agen(), 44))) # Michael S. Branicky, Dec 23 2023

A368214 Primes with a single 0-bit in binary expansion such that changing the position of the 0-bit always gives a nonprime (including the one with a leading zero).

Original entry on oeis.org

2, 2039, 6143, 522239, 33546239, 260046847, 16911433727, 32212254719, 2196875771903, 140735340871679, 2251799813685119, 9005000231485439, 576460752169205759, 36893488147410714623, 147573811852188057599, 9444732965739282038783, 154742504910672534362390399
Offset: 1

Views

Author

Ya-Ping Lu, Dec 23 2023

Keywords

Comments

It seems that most of the terms end with '9', followed by those ending with '3', '7', and '1'.

Examples

			2 is a term because 2 is a prime with one '0' in binary form ('10') and '01' is not a prime. 2039 is a term because 2039 is a prime with one '0' in binary form ('11111110111') and changing the position of the '0', for example, '11111111011' = 2043 and '01111111111' = 1023, always results in a composite.
		

Crossrefs

Subsequence of A095078.

Programs

  • Python
    from sympy import isprime
    for n in range(1,100):
        s = n*'1'; c = 0
        for j in range(n+1):
            num = int(s[:j]+'0'+s[j:], 2)
            if isprime(num):
                c += 1
                if c == 1: r = num
                if c == 2: break
        if c == 1: print(r, end = ', ')
Showing 1-7 of 7 results.