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

A007500 Primes whose reversal in base 10 is also prime (called "palindromic primes" by David Wells, although that name usually refers to A002385). Also called reversible primes.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 101, 107, 113, 131, 149, 151, 157, 167, 179, 181, 191, 199, 311, 313, 337, 347, 353, 359, 373, 383, 389, 701, 709, 727, 733, 739, 743, 751, 757, 761, 769, 787, 797, 907, 919, 929, 937, 941, 953, 967, 971, 983, 991, 1009, 1021
Offset: 1

Views

Author

Keywords

Comments

The numbers themselves need not be palindromes.
The range is a subset of the range of A071786. - Reinhard Zumkeller, Jul 06 2009
Number of terms less than 10^n: 4, 13, 56, 260, 1759, 11297, 82439, 618017, 4815213, 38434593, ..., . - Robert G. Wilson v, Jan 08 2015

References

  • Roozbeh Hazrat, Mathematica: A Problem-Centered Approach, Springer 2010, pp. 39, 131-132
  • 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.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, 134.

Crossrefs

Cf. A002385 (primes that are palindromes in base 10).
Equals A002385 union A006567.
Complement of A076056 with respect to A000040. [From Reinhard Zumkeller, Jul 06 2009]

Programs

  • Haskell
    a007500 n = a007500_list !! (n-1)
    a007500_list = filter ((== 1) . a010051 . a004086) a000040_list
    -- Reinhard Zumkeller, Oct 14 2011
    
  • Magma
    [ p: p in PrimesUpTo(1030) | IsPrime(Seqint(Reverse(Intseq(p)))) ];  // Bruno Berselli, Jul 08 2011
    
  • Maple
    revdigs:= proc(n)
    local L,nL,i;
    L:= convert(n,base,10);
    nL:= nops(L);
    add(L[i]*10^(nL-i),i=1..nL);
    end:
    Primes:= select(isprime,{2,seq(2*i+1,i=1..5*10^5)}):
    Primes intersect map(revdigs,Primes); # Robert Israel, Aug 14 2014
  • Mathematica
    Select[ Prime[ Range[ 168 ] ], PrimeQ[ FromDigits[ Reverse[ IntegerDigits[ # ] ] ] ]& ] (* Zak Seidov, corrected by T. D. Noe *)
    Select[Prime[Range[1000]],PrimeQ[IntegerReverse[#]]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 15 2016 *)
  • PARI
    is_A007500(n)={ isprime(n) & is_A095179(n)} \\ M. F. Hasler, Jan 13 2012
    
  • Python
    from sympy import prime, isprime
    A007500 = [prime(n) for n in range(1,10**6) if isprime(int(str(prime(n))[::-1]))] # Chai Wah Wu, Aug 14 2014
    
  • Python
    from gmpy2 import is_prime, mpz
    from itertools import count, islice, product
    def agen(): # generator of terms
        yield from [2, 3, 5, 7]
        p = 11
        for digits in count(2):
            for first in "1379":
                for mid in product("0123456789", repeat=digits-2):
                    for last in "1379":
                        s = first + "".join(mid) + last
                        if is_prime(t:=mpz(s)) and is_prime(mpz(s[::-1])):
                            yield int(t)
    print(list(islice(agen(), 60))) # Michael S. Branicky, Jan 02 2025

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Oct 31 2000
Added further terms to the sequence Avik Roy (avik_3.1416(AT)yahoo.co.in), Jan 16 2009. Checked by N. J. A. Sloane, Jan 20 2009.
Third reference added by Harvey P. Dale, Oct 17 2011

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

A204219 Primes whose binary reversal is not prime.

Original entry on oeis.org

2, 19, 59, 79, 89, 103, 109, 137, 139, 149, 157, 179, 191, 211, 239, 241, 271, 281, 293, 311, 317, 347, 367, 379, 389, 397, 401, 419, 439, 457, 467, 499, 523, 541, 547, 557, 563, 569, 587, 593, 607, 613, 641, 647, 659, 673, 719, 733, 743, 751, 761, 769, 787, 809, 811, 829, 859, 863, 877, 887, 919, 929, 971, 977, 983, 991, 997
Offset: 1

Views

Author

M. F. Hasler, Jan 13 2012

Keywords

Crossrefs

Complement of A074832 in A000040.
Cf. A076056, the base 10 equivalent.

Programs

  • Mathematica
    a = {}; For[n = 1, n <= 1000, n++, If[PrimeQ[n], {d = Reverse[ IntegerDigits[n,2]]; If[!PrimeQ[FromDigits[d,2]], AppendTo[a, n]]}]]; a (* Hasler *)
    Select[Prime[Range[170]], Not[PrimeQ[FromDigits[Reverse[IntegerDigits[#, 2]], 2]]] &] (* Alonso del Arte, Jan 13 2012 *)
  • PARI
    forprime(p=1,1e3,if(!isprime(sum(i=1,#b=binary(p),b[i]<
    				
  • PARI
    isok(k) = isprime(k) && !isprime(fromdigits(Vecrev(binary(k)), 2)); \\ Michel Marcus, Feb 19 2021
    
  • Python
    from sympy import isprime, primerange
    def ok(p): return not isprime(int(bin(p)[:1:-1], 2))
    def aupto(lim): return [p for p in primerange(2, lim+1) if ok(p)]
    print(aupto(1000)) # Michael S. Branicky, Feb 19 2021

A151768 Complement of A071786.

Original entry on oeis.org

19, 23, 29, 41, 43, 46, 47, 53, 57, 58, 59, 61, 67, 69, 82, 83, 86, 87, 89, 94, 103, 109, 115, 116, 122, 123, 127, 129, 137, 138, 139, 141, 159, 161, 163, 171, 173, 174, 177, 178, 183, 193, 197, 201, 203, 205, 206, 207, 209, 211, 215, 218, 223, 227, 229, 230
Offset: 1

Views

Author

N. J. A. Sloane, Jun 22 2009

Keywords

Comments

A number n > 1 is in the sequence if and only if n/A004086(p) is in the sequence for all primes p with A004086(p) dividing n. [Hagen von Eitzen, Jun 23 2009]
A076056 is a subsequence. [Reinhard Zumkeller, Jul 06 2009]

Programs

  • Maple
    read("transforms") ; tdpr := proc(nd) local p,n ; p := [] ; for n from 1 do if ithprime(n) > 10^nd then break; else p := [op(p),digrev(ithprime(n))] ; fi; od: sort(p) ; end: A071786 := proc(L,nd) local tmp,tmp2,j,k,i ; tmp := [] ; for j from 0 do if op(1,L)^j > 10^nd then break; fi; tmp := [op(tmp),op(1,L)^j] ; od: for i from 2 to nops(L) do tmp2 := {} ; for k from 1 to nops(tmp) do for j from 0 do if op(k,tmp)*op(i,L)^j > 10^nd then break; fi; tmp2 := tmp2 union { op(k,tmp)*op(i,L)^j} ; od: od: tmp := convert(tmp2,list) ; od: tmp ; end: maxp10 := 3 : L := tdpr(maxp10) : a151768c := A071786(L,maxp10) : for n from 1 to 10^maxp10 do if not n in a151768c then printf("%d,",n) ; fi; od: # R. J. Mathar, Jun 24 2009
  • PARI
    A=Set([]);for(n=2,300,ok=0;fordiv(n,d,if(!setsearch(A,d)&&isprime(rev(n/d)),ok=1;break));if(!ok,print1(n,",");A=setunion(A,Set([n])))) \\ Hagen von Eitzen, Jun 23 2009

Extensions

More terms from Hagen von Eitzen and R. J. Mathar, Jun 23 2009

A180006 Composite numbers that can be obtained from primes by interchanging the first and last digits.

Original entry on oeis.org

91, 32, 92, 14, 34, 74, 35, 95, 16, 76, 38, 98, 301, 901, 721, 731, 931, 361, 371, 391, 791, 112, 322, 722, 922, 332, 932, 142, 152, 752, 362, 962, 172, 772, 182, 382, 392, 703, 713, 133, 943, 763, 973, 793, 104, 904, 914, 124, 134, 334, 934, 344, 944, 754
Offset: 1

Views

Author

Parthasarathy Nambi, Aug 06 2010

Keywords

Comments

The primes must contain at least two digits.

Examples

			The composite number 752 is obtained from the prime 257 by interchanging the first and last digits.
		

Crossrefs

The corresponding primes are A076056. Cf. A002808, A179826.

Programs

  • Mathematica
    Select[With[{idn=IntegerDigits[#]},FromDigits[Join[{idn[[-1]]},Most[Rest[idn]],{idn[[1]]}]]]&/@Prime[Range[5,1500]],CompositeQ] (* Harvey P. Dale, Jan 26 2025 *)

Extensions

More terms from Vincenzo Librandi, Aug 06 2010

A054658 Primes beginning 1, 3, 7, 9 whose reversals are nonprimes.

Original entry on oeis.org

19, 103, 109, 127, 137, 139, 163, 173, 193, 197, 307, 317, 331, 349, 367, 379, 397, 719, 773, 911, 947, 977, 997, 1013, 1019, 1039, 1049, 1051, 1063, 1087, 1093, 1117, 1123, 1129, 1163, 1171, 1187, 1277, 1289, 1291, 1297, 1303, 1307, 1319, 1327, 1361
Offset: 1

Views

Author

Enoch Haga, Apr 18 2000

Keywords

Comments

Or, primes whose reversals are composites ending in 1,3,7,9. - Lekraj Beedassy, Aug 02 2008
A subsequence of A143260. - Lekraj Beedassy, Aug 02 2008

Examples

			a(1)=19 because its reverse is a nonprime, 91.
		

Crossrefs

Programs

  • Mathematica
    pbQ[p_]:=MemberQ[{1,3,7,9},IntegerDigits[p][[1]]]&&CompositeQ[IntegerReverse[p]]; Select[Prime[Range[300]],pbQ] (* Harvey P. Dale, Dec 02 2024 *)

Extensions

Edited by N. J. A. Sloane, Aug 29 2008 at the suggestion of R. J. Mathar
Showing 1-6 of 6 results.