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

A359136 Primes such that there is a nontrivial permutation which when applied to the digits produces a prime (Version 1).

Original entry on oeis.org

11, 13, 17, 31, 37, 71, 73, 79, 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, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 419, 421
Offset: 1

Views

Author

Keywords

Comments

A prime p with decimal expansion p = d_1 d_2 ... d_m is in this sequence iff there is a non-identity permutation pi in S_m such that q = d_pi(1) d_pi(2) ... d_pi(m) is also a prime. The prime q may or may not be equal to p. Leading zeros are permitted in q.
One must be careful when using the phrase "nontrivial permutation of the digits". When the first and third digits of 101 are exchanged, this is applying the nontrivial permutation (1,3) in S_3 to the digits, leaving the number itself unchanged. One should specify whether it is the permutation that is nontrivial, or its action on what is being permuted. In this sequence and A359137, we mean that the permutation itself is nontrivial.
There are only 34 primes not in this sequence, the greatest of which is 5849. - Andrew Howroyd, Jan 22 2023

Crossrefs

Many OEIS entries are subsequences (possibly after omitting 2, 3, 5, and 7): A007500, A055387, A061461, A069706, A090933, A225035.

Programs

  • PARI
    isok(n)={my(v=vecsort(digits(n))); if(#Set(v)<#v, 1, forperm(v, u, my(t=fromdigits(Vec(u))); if(isprime(t) && t<>n, return(1))); 0)} \\ Andrew Howroyd, Jan 22 2023
    
  • Python
    from sympy import isprime
    from itertools import permutations as P
    def ok(n):
        if not isprime(n): return False
        if len(s:=str(n)) > len(set(s)): return True
        return any(isprime(t) for t in (int("".join(p)) for p in P(s)) if t!=n)
    print([k for k in range(422) if ok(k)]) # Michael S. Branicky, Jan 23 2023

Extensions

More than the usual number of terms are shown in order to distinguish this from neighboring sequences.
Incorrect terms removed by Andrew Howroyd, Jan 22 2023

A225035 Primes such that there is a nontrivial rearrangement of the digits which is a prime.

Original entry on oeis.org

13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 239, 241, 251, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 359, 367, 373, 379, 389, 397, 401, 419, 421
Offset: 1

Views

Author

Jayanta Basu, Apr 24 2013

Keywords

Comments

The new prime is necessarily different from the original prime (so 11, for example) is not a term. - N. J. A. Sloane, Jan 22 2023
Permutations producing leading zeros are allowed: thus 101 is in the sequence because a nontrivial permutation of its digits is 011. - Robert Israel, Aug 13 2019
It seems reasonable to expect that the proportion of n-digit primes that are in this sequence approaches 1 as n increases. - Peter Munn, Sep 13 2022

Examples

			13 is a term since a nontrivial permutation of its digits yields 31, which is also a prime.
		

References

  • H.-E. Richert, On permutation prime numbers, Norsk. Mat. Tidsskr. 33 (1951), p. 50-53.
  • Joe Roberts, Lure of the Integers, Math. Assoc. of Amer., 1992, p. 293.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Second Edition, Cambridge University Press, p. 121.

Crossrefs

See A055387, A359136-A359139 for other versions.

Programs

  • Maple
    dmax:=3: # for all terms of up to dmax digits
    Res:= {}:
    p:= 1:
    do
      p:= nextprime(p);
      if p > 10^dmax then break fi;
      L:= sort(convert(p,base,10),`>`);
      m:= add(L[i]*10^(i-1),i=1..nops(L));
      if assigned(A[m]) then
        if ilog10(A[m])=ilog10(p) then
          Res:= Res union {A[m], p}
        else Res:= Res union {p}
        fi
      else A[m]:= p
      fi
    od:
    sort(convert(Res,list)); # Robert Israel, Aug 13 2019
  • Mathematica
    t={}; Do[p = Prime[n]; list1 = Permutations[IntegerDigits[p]]; If[Length[ Select[Table[FromDigits[n], {n,list1}], PrimeQ]] > 1, AppendTo[t,p]], {n,84}]; t
  • PARI
    is(p) = if(isprime(p), my(d=vecsort(digits(p))); d==vector(#d,x,1)&&return(1); forperm(d, e, my(c = fromdigits(Vec(e))); p!=c && isprime(c) && return(1))); \\ Ruud H.G. van Tol, Jan 22 2023
  • Python
    from sympy import isprime
    from itertools import permutations
    def ok(n):
        if not isprime(n): return False
        perms = (int("".join(p)) for p in permutations(str(n)))
        return any(isprime(t) for t in perms if t != n)
    print([k for k in range(500) if ok(k)]) # Michael S. Branicky, Sep 14 2022
    

Extensions

Edited by N. J. A. Sloane, Jan 22 2023

A116692 Primes with only one distinct decimal digit. Also called repunit primes or repdigit primes.

Original entry on oeis.org

2, 3, 5, 7, 11, 1111111111111111111, 11111111111111111111111
Offset: 1

Views

Author

Rick L. Shepherd, Feb 22 2006

Keywords

Comments

Primes in A010785 (repdigit numbers). Union of single-digit primes and A004022 (repunit primes). A004023 shows that the next term has 317 1's. The Mersenne primes (A000668) are the binary analog (i.e., bits are all 1's).

References

  • Clifford A. Pickover, A Passion for Mathematics (2005) at 60, 297.

Crossrefs

A004022 is a subsequence.
A subsequence of A055387, but not of A225053.

Extensions

Reference provided by Harvey P. Dale, Apr 19 2014
Definition expanded by N. J. A. Sloane, Jan 22 2023

A085298 a(n) is the smallest exponent x such that prime(n)^x when reversed is a prime.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 2, 8, 7, 1, 1, 2, 5, 15, 10, 12, 4, 39, 1, 1, 1, 11, 2, 1, 1, 10, 1, 23, 1, 5, 1, 243, 2, 1, 1, 1, 23, 1, 34, 1, 1, 1, 2, 58, 1, 3, 9, 166, 17, 68, 8, 8, 3, 7, 5, 5, 2, 2, 2, 61, 11, 97, 1, 1, 10, 2, 1, 1, 41, 1, 1, 66, 1, 5, 1, 1, 2, 2, 8, 40, 2, 8, 19, 2, 2, 723
Offset: 1

Views

Author

Labos Elemer, Jun 24 2003

Keywords

Comments

It is conjectured that for every n such exponent exists.

Examples

			a(n)=1 means that rev(prime(n)) is prime i.e. prime(n) is in A007500;
a(n)=2 means that rev(prime(n)^2) is prime but rev(prime(n)) is not, like n=8:p=19 and 91 is not a prime but rev[19^2]=rev[361]=163 is a prime;
For n, the first k exponent providing rev(prime(n)^k) prime can be quite large, like at n=87: rev(p(87)^723)=rev(449^723) is the first [probably] prime has 1918 decimal digits: 948......573.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local k, p; p:= ithprime(n); for k while not isprime((s->
          parse(cat(seq(s[-i], i=1..length(s)))))(""||(p^k))) do od; k
        end:
    seq(a(n), n=1..50);  # Alois P. Heinz, Sep 04 2019
  • Mathematica
    a[n_] := Block[{k = 1}, While[! PrimeQ@ FromDigits@ Reverse@ IntegerDigits[ Prime[n]^k], k++]; k]; Array[a, 87] (* Giovanni Resta, Sep 04 2019 *)
  • PARI
    a(n) = {my(x=1, p=prime(n)); while (!ispseudoprime(fromdigits(Vecrev(digits(p^x)))), x++); x;} \\ Michel Marcus, Sep 04 2019

Formula

a(n) = Min{x; reversed(prime(n)^x) is a prime}.

A085300 a(n) is the least prime x such that when reversed it is a power of prime(n).

Original entry on oeis.org

2, 3, 5, 7, 11, 31, 71, 163, 18258901387, 90367894271, 13, 73, 1861, 344800741, 34351783286302805384336021, 940315563074788471, 1886172359328147919771, 14854831
Offset: 1

Views

Author

Labos Elemer, Jun 24 2003

Keywords

Comments

A006567 (after rearranging terms) and A002385 are subsequences. - Chai Wah Wu, Jun 02 2016

Examples

			a(14)=344800741 means that 147008443=43^5=p(14)^5, where 5 is the smallest such exponent;
a(19) has 82 decimal digits and if reversed equals 39th power of p(19)=67.
		

Crossrefs

Programs

  • Python
    from sympy import prime, isprime
    def A085300(n):
        p = prime(n)
        q = p
        while True:
            m = int(str(q)[::-1])
            if isprime(m):
                return(m)
            q *= p # Chai Wah Wu, Jun 02 2016

A166681 Primes p which have at least one prime anagram larger than p.

Original entry on oeis.org

13, 17, 37, 79, 107, 113, 127, 131, 137, 139, 149, 157, 163, 167, 173, 179, 181, 191, 197, 199, 239, 241, 251, 277, 281, 283, 313, 337, 347, 349, 359, 367, 373, 379, 389, 397, 419, 457, 461, 463, 467, 479, 491, 563, 569, 571, 577, 587, 593, 613
Offset: 1

Views

Author

Pierre CAMI, Oct 18 2009

Keywords

Comments

Primes like 113, 137, 149, 157 etc have more than one such larger anagram, but are only listed once.

Examples

			13 is the first with 31 as prime anagram.
17 is the second with 71 as prime anagram.
31 has one anagram 13 but this is not >31 so 31 is not in the sequence.
		

Crossrefs

Programs

  • Maple
    filter:= proc(p) local L,Lp,q,i;
      if not isprime(p) then return false fi;
      L:= convert(p,base,10);
      for Lp in combinat:-permute(L) do
        q:= add(Lp[i]*10^(i-1),i=1..nops(L));
        if q > p and isprime(q) then return true fi
      od;
    false
    end proc:
    select(filter, [seq(i,i=13..1000,2)]); # Robert Israel, Jan 18 2023
  • Mathematica
    paQ[n_]:=Length[Select[FromDigits/@Permutations[IntegerDigits[n]],#>n && PrimeQ[#]&]]>0; Select[Prime[Range[200]],paQ] (* Harvey P. Dale, Sep 23 2013 *)
  • Python
    from itertools import islice
    from sympy.utilities.iterables import multiset_permutations
    from sympy import isprime, nextprime
    def A166681_gen(): # generator of terms
        p = 13
        while True:
            for q in multiset_permutations(str(p)):
                if (r:=int(''.join(q)))>p and isprime(r):
                    yield p
                    break
            p = nextprime(p)
    A166681_list = list(islice(A166681_gen(),20)) # Chai Wah Wu, Jan 17 2023

Extensions

Definition clarified, sequence extended. - R. J. Mathar, Oct 12 2012

A178316 Primes whose digital rotation is still prime.

Original entry on oeis.org

2, 5, 11, 19, 61, 101, 109, 151, 181, 199, 601, 619, 659, 661, 1019, 1021, 1061, 1091, 1109, 1129, 1151, 1181, 1201, 1229, 1259, 1291, 1511, 1559, 1601, 1609, 1621, 1669, 1699, 1811, 1901, 1999, 6011, 6091, 6101, 6199, 6211, 6221, 6229, 6521, 6551, 6569
Offset: 1

Views

Author

David Nacin, May 24 2010

Keywords

Comments

This means if written as in a digital clock and rotated 180 degrees around the center the result is also prime (possibly a different prime).

Examples

			For example 1259 becomes 6521 under such a rotation.
		

References

  • Guy, R. K., Unsolved Problems in Number Theory, p 15 This sequence is related to the palindromic primes with symmetries as in Guy's book.

Crossrefs

Programs

  • Mathematica
    Select[Range[6570],PrimeQ[#]&&PrimeQ[FromDigits[Reverse[IntegerDigits[#]/.{6->9,9->6}]]]&&ContainsOnly[IntegerDigits[#],{0,1,2,5,6,8,9}]&] (* James C. McMahon, Apr 09 2024 *)
  • Python
    from itertools import count, islice, product
    from sympy import isprime
    def A178316_gen():
        yield from (2,5)
        r = ''.maketrans('69','96')
        for l in count(1):
            for a in '125689':
                for d in product('0125689',repeat=l):
                    s = a+''.join(d)
                    m = int(s)
                    if isprime(m) and isprime(int(s[::-1].translate(r))):
                        yield m
    A178316_list = list(islice(A178316_gen(),40)) # Chai Wah Wu, Apr 09 2024

A085299 a(n) is the smallest number x such that A085298[x]=n, or 0 if no such number exists.

Original entry on oeis.org

1, 8, 47, 18, 14, 89, 10, 9, 48, 16, 23, 17, 168, 268, 15, 661, 50, 380, 84, 116, 360, 245, 29, 144, 345, 227, 785, 261, 148, 235, 691, 658, 638, 40, 1023, 674, 1529, 210, 19, 81, 181, 428, 170, 1130, 2322, 406, 600, 373, 958, 217
Offset: 1

Views

Author

Labos Elemer, Jun 24 2003

Keywords

Examples

			a(13) = 168 means that 13 is the smallest exponent such that reversed[p(168)^13] = reversed[997^13] = 776831144302925059735912605306533496169
is prime if read in this direction and 13th prime-power if read backwards.
		

Crossrefs

A096598 Squares such that some permutation of digits is also a square (in decimal representation).

Original entry on oeis.org

100, 144, 169, 196, 256, 400, 441, 625, 900, 961, 1024, 1089, 1296, 1369, 1600, 1764, 1936, 2025, 2304, 2401, 2500, 2809, 2916, 3600, 4096, 4761, 4900, 6400, 7056, 8100, 9025, 9216, 9604, 9801, 10000, 10201, 10404, 10609, 10816, 11025
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 29 2004

Keywords

Comments

A062892(a(n)) > 1.

Examples

			1024 = 32^2 and also 2401=49^2, therefore 1024 (and 2401) is a term.
		

Crossrefs

A199713 Smallest prime greater than n-th prime containing all of its digits in decimal representation.

Original entry on oeis.org

23, 13, 53, 17, 101, 31, 71, 109, 223, 229, 103, 73, 149, 347, 347, 353, 359, 163, 167, 107, 137, 97, 283, 389, 179, 1013, 1013, 701, 1009, 131, 271, 311, 173, 193, 419, 1051, 571, 613, 617, 317, 197, 811, 911, 1039, 719, 919, 1021, 1223, 2027, 1229, 2333
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 09 2011

Keywords

Examples

			   n |  a(n)  | prime(n)
-----+--------+---------
   1 |    23  |     2
   2 |    13  |     3
   3 |    53  |     5
   4 |    17  |     7
   5 |   101  |    11
   6 |    31  |    13
   7 |    71  |    17
   8 |   109  |    19
   9 |   223  |    23
  10 |   229  |    29
....
  26 |  1013  |   101
  27 |  1013  |   103
  28 |   701  |   107
  29 |  1009  |   109
  30 |   131  |   113
  31 |   271  |   127
  32 |   311  |   131 .
		

Crossrefs

Programs

  • Haskell
    a199713 n = f ps where
       f (q:qs) = if sort (show q) `contains` sort (show p) then q else f qs
       contains _  []                         = True
       contains [] _                          = False
       contains (u:us) vs'@(v:vs) | u == v    = contains us vs
                                  | otherwise = contains us vs'
       p : ps = drop (n-1) a000040_list
Showing 1-10 of 11 results. Next