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

A076055 Composite numbers which when read backwards are primes.

Original entry on oeis.org

14, 16, 20, 30, 32, 34, 35, 38, 50, 70, 74, 76, 91, 92, 95, 98, 104, 106, 110, 112, 118, 119, 124, 125, 128, 130, 133, 134, 136, 140, 142, 145, 146, 152, 160, 164, 166, 170, 172, 175, 182, 188, 194, 196, 200, 300, 301, 305, 310, 316, 320, 322, 325, 328, 332
Offset: 1

Views

Author

Amarnath Murthy, Oct 04 2002

Keywords

Comments

If m is a term, then 10*m is another term. - Bernard Schott, Nov 20 2021

Crossrefs

Cf. A076056.
Intersection of A002808 and A095179.

Programs

  • Mathematica
    Rev[n_]:=FromDigits[Reverse[IntegerDigits[n]]];Select[Range[332],!PrimeQ[#] && PrimeQ[Rev[#]]&] (* Jayanta Basu, May 01 2013 *)
  • Python
    from sympy import isprime
    def ok(n): return not isprime(n) and isprime(int(str(n)[::-1]))
    print([k for k in range(333) if ok(k)]) # Michael S. Branicky, Nov 20 2021

Extensions

Corrected and extended by Sascha Kurz, Jan 20 2003

A085324 a(n) is the least exponent so that reverse(n^a(n)) is a prime number. a(n)=0 if no such exponent exists, namely when e.g., n = 3k or n = 11k, k > 1.

Original entry on oeis.org

0, 1, 1, 2, 1, 0, 1, 8, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 2, 1, 0, 0, 8, 0, 13, 47, 0, 2, 7, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 2, 2, 0, 5, 0, 0, 22, 15, 0, 6, 1, 0, 3, 10, 0, 0, 143, 0, 88, 12, 0, 4, 2, 0, 4, 8, 0, 39, 83, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 8, 0, 6, 11, 0, 2, 28, 0, 0, 2, 0, 1, 1, 0, 292, 1, 0, 1, 1
Offset: 1

Views

Author

Labos Elemer, Jul 02 2003

Keywords

Comments

a(k) = 1 for k in A095179. - Michel Marcus, Apr 09 2018

Examples

			For n=46, a(46)=22 means that reversion of 46^22 gives a prime: 6100744433653913942689966672393877083.
		

Crossrefs

Programs

  • Maple
    Rev:= proc(n) local L;
    L:= convert(n,base,10);
    add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    f:= proc(n) local k;
      if igcd(n,33) <> 1  then return 0 fi;
      if n mod 10 = 0 then return procname(n/10) fi;
      for k from 1 do if isprime(Rev(n^k)) then return k fi od:
    end proc:
    f(1):= 0: f(3):= 1; f(11):= 1;
    map(f, [$1..100]); # Robert Israel, Apr 09 2018
  • Mathematica
    nd[x_, y_] := 10*x+y; tn[x_] := Fold[nd, 0, x]; bac[x_] := tn[Reverse[IntegerDigits[x]]] t={list without 3k and 11k numbers}; le=Length[t]; Table[f=1; Do[s=bac[Part[t, n]^k]; If[PrimeQ[s]&&Equal[f, 1], Print[{k, Part[t, n], s}]; f=0], {k, 1, 300}], {n, 1, le}]

Formula

a(3k) = a(11k) = 0 for k > 1 because reversion does not make a prime from any of their powers.

A204232 Numbers whose binary reversal is prime.

Original entry on oeis.org

3, 5, 6, 7, 10, 11, 12, 13, 14, 17, 20, 22, 23, 24, 25, 26, 28, 29, 31, 34, 37, 40, 41, 43, 44, 46, 47, 48, 50, 52, 53, 55, 56, 58, 61, 62, 67, 68, 71, 73, 74, 77, 80, 82, 83, 86, 88, 91, 92, 94, 96, 97, 100, 101, 104, 106, 107, 110, 112, 113, 115, 116, 121
Offset: 1

Views

Author

M. F. Hasler, Jan 13 2012

Keywords

Comments

Base-2 analog of A095179.
If k is a term, then 2*k is a term too. - Michel Marcus, Apr 19 2020

Examples

			3, 5 and 7 are in the sequence because their binary reversal, equal to themselves, is prime.
a(3)=6 is in the sequence, because 6=110[2] (written in base 2), whose reversal 011[2]=3 is prime.
a(5)=11 is in the sequence, because 11=1011[2] (written in base 2), whose reversal 1101[2]=13 is prime.
		

Crossrefs

Positions of 2's in A227864.

Programs

  • Mathematica
    Select[Range[170], PrimeQ[FromDigits[Reverse[IntegerDigits[#, 2]], 2]] &] (* Alonso del Arte, Jan 13 2012 *)
  • PARI
    for(n=1,1e2,isprime((t=binary(n))*vector(#t,i,1<
    				
  • Python
    from sympy import isprime
    def ok(n): return isprime(int(bin(n)[2:][::-1], 2))
    print(list(filter(ok, range(1, 122)))) # Michael S. Branicky, Sep 06 2021
    
  • Python
    # alternate program constructing terms directly from primes
    from sympy import isprime, primerange
    def auptobits(maxbits):
        alst = []
        for p in primerange(3, 1<Michael S. Branicky, Oct 29 2024

A036971 Numbers k such that the k-th Fibonacci number reversed is prime.

Original entry on oeis.org

3, 4, 5, 7, 9, 14, 17, 21, 25, 26, 65, 98, 175, 191, 382, 497, 653, 1577, 1942, 1958, 2405, 4246, 4878, 5367, 9142, 9318, 10921, 17833, 20433, 50373, 66571, 85098, 93699, 104075
Offset: 1

Views

Author

Keywords

Comments

Numbers k such that the k-th Fibonacci number appears in A095179. - Iain Fox, Oct 28 2017

Crossrefs

Programs

  • Maple
    revdigs:= proc(n) local L;
    L:= convert(n,base,10);
    add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    select(isprime@revdigs@combinat:-fibonacci, [$1..10000]); # Robert Israel, Oct 29 2017
  • Mathematica
    a = Table[FromDigits[Reverse[IntegerDigits[Fibonacci[j]]]], {j, 10000}]; b = Select[a, PrimeQ[ # ] &]; Flatten[Table[Position[a, b[[i]]], {i, 1, Length[b]}]]
    Select[Range[9400],PrimeQ[IntegerReverse[Fibonacci[#]]]&] (* The program uses the IntegerReverse function from Mathematica version 10 *) (* Harvey P. Dale, Dec 08 2015 *)
  • PARI
    lista(nn) = for(n=3, nn, if(ispseudoprime(eval(concat(Vecrev(Str(fibonacci(n)))))), print1(n, ", "))) \\ Iain Fox, Oct 28 2017

Extensions

a(25)-a(26) from Vit Planocka (planocka(AT)mistral.cz), Feb 25 2003
Offset corrected by Arkadiusz Wesolowski, Jan 12 2012
a(27)-a(31) from Iain Fox, Oct 28 2017
a(32)-a(33) from Iain Fox, Oct 29 2017
a(34) from Iain Fox, Aug 24 2021

A111347 Numbers n such that the result of swapping the 2nd and next to the last digit of n is prime.

Original entry on oeis.org

11, 13, 14, 16, 17, 20, 30, 31, 32, 34, 35, 37, 38, 50, 70, 71, 73, 74, 76, 79, 91, 92, 95, 97, 98, 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, 257, 263, 269, 271
Offset: 1

Views

Author

Cino Hilliard, Nov 05 2005

Keywords

Comments

Similar to A007934 and A095179 for the first few terms.
Since these numbers are just digit permutations of the primes the sequence is obviously infinite. - Charles R Greathouse IV, Oct 20 2008

Crossrefs

Programs

  • PARI
    swapn(n,d) = \ d is the digit position to swap { local(j,ln,x,s,y,y2,tmp); for(x=10^(d-1),10^(d-1)+n, s = Str(x); ln = length(s); y = eval(Vec(s)); tmp=y[d]; y[d]=y[ln-d+1]; y[ln-d+1]=tmp; y2=0; for(j=1,ln, y2+=y[j]*10^(ln-j); ); if(isprime(y2),print1(x",")) ) }

Formula

For N1 = a(n)*10^n + a(n-1)*10^(n-1) + ... + a(1)*10 + a(0), N2 = a(n)*10^n + a(1)*10^(n-1) + ... + a(n-1)*10 + a(0) is prime.

A097312 Numbers with property that can bring the first digit to the back of the number to get a prime (zeros are dropped).

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 14, 16, 17, 20, 30, 31, 32, 34, 35, 37, 38, 50, 70, 71, 73, 74, 76, 79, 91, 92, 95, 97, 98, 101, 103, 104, 106, 107, 110, 113, 115, 118, 119, 121, 124, 125, 127, 128, 131, 133, 140, 142, 143, 146, 149, 152, 154, 157, 160, 163, 164, 166, 169, 170
Offset: 1

Views

Author

Jason Earls, Mar 16 2005

Keywords

Comments

First differs from A095179 at a(31) = 103 since A095179(31) = 104 because 401 is prime but 301 = 7 * 43. - Alonso del Arte, Apr 12 2020

Examples

			1234 is in the sequence because 2341 is prime.
		

Programs

  • Mathematica
    Select[Range[200],PrimeQ[FromDigits[RotateLeft[IntegerDigits[#]]]] &] (* Harvey P. Dale, Jun 06 2018 *)
  • Python
    from sympy import isprime
    def ok(n): s = str(n); return isprime(int(s[1:]+s[0]))
    print([k for k in range(171) if ok(k)]) # Michael S. Branicky, May 08 2023

A111348 Numbers n such that the result of swapping the 3rd and next to the next to the last digit of a number is prime.

Original entry on oeis.org

101, 104, 106, 107, 110, 112, 113, 118, 119, 124, 125, 128, 130, 131, 133, 134, 136, 140, 142, 145, 146, 149, 151, 152, 157, 160, 164, 166, 167, 170, 172, 175, 179, 181, 182, 188, 191, 194, 196, 199, 200, 300, 301, 305, 310, 311, 313, 316, 320, 322, 325
Offset: 1

Views

Author

Cino Hilliard, Nov 05 2005

Keywords

Comments

Similar to A095179 for the first few terms.
Since these numbers are just digit permutations of the primes the sequence is obviously infinite. - Charles R Greathouse IV, Oct 20 2008

Crossrefs

Programs

  • PARI
    swapn(n,d) = \ d is the digit position to swap { local(j,ln,x,s,y,y2,tmp); for(x=10^(d-1),10^(d-1)+n, s = Str(x); ln = length(s); y = eval(Vec(s)); tmp=y[d]; y[d]=y[ln-d+1]; y[ln-d+1]=tmp; y2=0; for(j=1,ln, y2+=y[j]*10^(ln-j); ); if(isprime(y2),print1(x",")) ) }

Formula

For N1=a(n)*10^n+a(n-1)*10^(n-1)+a(n-2)*10^(n-2)+...+a(2)*10^2+a(1)*10 + a(0), N2=a(n)*10^n+a(n-1)*10^(n-1)+a(2)*10^(n-2)+...+a(n-2)*10^2+a(1)*10 + a(0) is prime.

A111349 Numbers n such that the result of swapping the 4th digit and the digit 3 positions from the last digit is prime.

Original entry on oeis.org

1003, 1004, 1007, 1009, 1010, 1012, 1013, 1015, 1016, 1018, 1019, 1021, 1024, 1025, 1030, 1031, 1040, 1043, 1049, 1051, 1054, 1055, 1060, 1061, 1063, 1070, 1082, 1085, 1088, 1091, 1094, 1096, 1099, 1100, 1105, 1106, 1108, 1112, 1114, 1118, 1123, 1126
Offset: 1

Views

Author

Cino Hilliard, Nov 05 2005

Keywords

Comments

Leading zeros are dropped.
Since these numbers are just digit permutations of the primes the sequence is obviously infinite. - Charles R Greathouse IV, Oct 20 2008

Crossrefs

Programs

  • PARI
    swapn(n,d) = \ d is the digit position to swap { local(j,ln,x,s,y,y2,tmp); for(x=10^(d-1),10^(d-1)+n, s = Str(x); ln = length(s); y = eval(Vec(s)); tmp=y[d]; y[d]=y[ln-d+1]; y[ln-d+1]=tmp; y2=0; for(j=1,ln, y2+=y[j]*10^(ln-j); ); if(isprime(y2),print1(x",")) ) }

A227864 Smallest base in which n's digital reversal is prime, or 0 if no such base exists.

Original entry on oeis.org

0, 0, 3, 2, 0, 2, 2, 2, 4, 6, 2, 2, 2, 2, 2, 3, 8, 2, 3, 3, 2, 3, 2, 2, 2, 2, 2, 9, 2, 2, 6, 2, 4, 3, 2, 3, 12, 2, 6, 3, 2, 2, 6, 2, 2, 3, 2, 2, 2, 3, 2, 9, 2, 2, 3, 2, 2, 3, 2, 4, 12, 2, 2, 3, 12, 3, 6, 2, 2, 3, 10, 2, 6, 2, 2, 3, 10, 2, 26, 3, 2, 27, 2, 2
Offset: 0

Views

Author

Carl R. White, Nov 01 2013

Keywords

Comments

0 and 1 are not prime and are single digits in all bases, so no reversal of digits can make them prime. a(n) is therefore 0 for both.
4 is not prime and so cannot be prime if reversed in any base where it is a single digit. This leaves bases 2 and 3 where, upon reversal, it is 1 and 4 respectively. Neither are prime, and so a(4) is also 0.
Conjecture 1: 0, 1 and 4 are the only values where there is no base in which a digital reversal makes a prime.
It is clear that for any prime p, a(p) cannot be zero, since a(p)=p+1 is a solution if there is none smaller.
Conjecture 2: n = 2 is the only prime p which must be represented in base p+1, i.e., trivially, as a single digit, in order for its reversal to be prime.
Corollary: Since a(n) cannot be n itself -- reversing n in base n obtains 1, which is not prime -- this would mean that for all positive n except 2, a(n) < n.
Other than its small magnitude, a(n) = 2 occurs often due to the fact that a reversed positive binary number is guaranteed to be odd and thus stands a greater chance of being prime.
Similarly, many solutions exist solely because reversal removes all powers of the base from n, reducing the number of divisors. Thus based solely on observation:
Conjecture 3: With the restriction gcd(base,n) = 1, a(n) = 0 except for n = 2, 3 and 6k+-1, for positive integer k, i.e., terms of A038179.

Examples

			9 in base 2 is 1001, which when reversed is the same and so not prime. In base 3 it is 100, which becomes 1 when reversed and also not prime. Base 4: 21 -> 12 (6 decimal), not prime; Base 5: 14 -> 41 (21 decimal), not prime; Base 6: 13 -> 31 (19 decimal), which is prime, so a(9) = 6, i.e., 6 is the smallest base in which 9's digital reversal is a prime number.
		

Crossrefs

Positions of 2's: A204232.

Programs

  • Python
    from sympy import isprime
    from sympy.ntheory.digits import digits
    def okb(n, b):
        return isprime(sum(d*b**i for i, d in enumerate(digits(n, b)[1:])))
    def a(n):
        for b in range(2, n+2):
            if okb(n, b): return b
        return 0
    print([a(n) for n in range(84)]) # Michael S. Branicky, Sep 06 2021

A371653 Numbers k such that the number formed by putting the digits of k in descending order is prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 14, 16, 17, 31, 34, 35, 37, 38, 41, 43, 53, 61, 71, 73, 79, 83, 97, 112, 113, 118, 119, 121, 124, 125, 128, 131, 133, 134, 136, 142, 143, 145, 146, 149, 152, 154, 157, 163, 164, 166, 167, 175, 176, 179, 181, 182, 188, 191, 194, 197, 199
Offset: 1

Views

Author

César Eliud Lozada, Apr 01 2024

Keywords

Comments

Numbers k such that A004186(k) is prime. - Robert Israel, Apr 01 2024
If N is a term then all numbers with the same digits as N are terms too.

Examples

			142 is a term because its digits in decreasing order form 421 and this is prime.
		

Crossrefs

Programs

  • Maple
    dd:= proc(n) local L,i;
       L:= sort(convert(n,base,10));
       add(L[i]*10^(i-1),i=1..nops(L))
    end proc:
    select(isprime @ dd, [$1..1000]); # Robert Israel, Apr 01 2024
  • Mathematica
    Select[Range[500], PrimeQ[FromDigits[ReverseSort[IntegerDigits[#]]]] &]
  • Python
    from sympy import isprime
    def ok(n): return isprime(int("".join(sorted(str(n), reverse=True))))
    print([k for k in range(200) if ok(k)]) # Michael S. Branicky, Apr 01 2024
    
  • Python
    from itertools import count, islice, combinations_with_replacement
    from sympy import isprime
    from sympy.utilities.iterables import multiset_permutations
    def A371653_gen(): # generator of terms
        for l in count(1):
            xlist = []
            for p in combinations_with_replacement('987654321',l):
                if isprime(int(''.join(p))):
                    xlist.extend(int(''.join(d)) for d in multiset_permutations(p))
            yield from sorted(xlist)
    A371653_list = list(islice(A371653_gen(),30)) # Chai Wah Wu, Apr 10 2024
Showing 1-10 of 16 results. Next