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

A061783 Luhn primes: primes p such that p + (p reversed) is also a prime.

Original entry on oeis.org

229, 239, 241, 257, 269, 271, 277, 281, 439, 443, 463, 467, 479, 499, 613, 641, 653, 661, 673, 677, 683, 691, 811, 823, 839, 863, 881, 20011, 20029, 20047, 20051, 20101, 20161, 20201, 20249, 20269, 20347, 20389, 20399, 20441, 20477, 20479, 20507
Offset: 1

Views

Author

Amarnath Murthy, May 24 2001

Keywords

Comments

a(n) has an odd number of digits, as otherwise a(n) + reverse(a(n)) is a multiple of 11. For a(n) > 10, a(n) is prime and thus odd, and therefore the first digit of a(n) is even as otherwise a(n) + reverse(a(n)) is even and composite. - Chai Wah Wu, Aug 19 2015
See A072385 for the resulting primes p + reverse(p) = A056964(p). - M. F. Hasler, Sep 26 2019
Named by Cira and Smarandache (2014) after Norman Luhn, who noted the property of the prime 229 on the Prime Curios! website. - Amiram Eldar, Jun 05 2021

Examples

			229 is a term since 229 is a prime and so is 229 + 922 = 1151.
		

Crossrefs

Cf. A004086 (reverse), A004087 (primes reversed), A056964 (reverse & add), A072385, A086002 (similar, using "rotate" instead of "reverse").

Programs

  • Magma
    [NthPrime(n): n in [1..2400] | IsPrime(s) where s is NthPrime(n)+Seqint(Reverse(Intseq(NthPrime(n))))]; // Bruno Berselli, Aug 05 2013
    
  • Mathematica
    Select[Prime[Range[3000]],PrimeQ[#+FromDigits[Reverse[IntegerDigits[#]]]]&] (* Harvey P. Dale, Nov 27 2010 *)
  • PARI
    isok(p) = { isprime(p) && isprime(p + fromdigits(Vecrev(digits(p)))) } \\ Harry J. Smith, Jul 28 2009
    
  • PARI
    select( is_A061783(p)=isprime(A056964(p)) && isprime(p), primes(8713)) \\  A056964(p)=p+fromdigits(Vecrev(digits(p))). There is no term with 4 digits or starting with an odd digit, i.e., no candidate between prime(168) = 997 and prime(2263) = 20011. Using primes up to prime(8713) = 89989 ensures the list of 5-digit terms is complete. - M. F. Hasler, Sep 26 2019
    
  • Python
    from sympy import isprime, prime
    A061783 = [prime(n) for n in range(1,10**5) if isprime(prime(n)+int(str(prime(n))[::-1]))] # Chai Wah Wu, Aug 14 2014

Extensions

Corrected and extended by Patrick De Geest, May 26 2001
Cross-references added by M. F. Hasler, Sep 26 2019

A071786 In prime factorization of n replace each prime with its reversal (in decimal notation).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 31, 14, 15, 16, 71, 18, 91, 20, 21, 22, 32, 24, 25, 62, 27, 28, 92, 30, 13, 32, 33, 142, 35, 36, 73, 182, 93, 40, 14, 42, 34, 44, 45, 64, 74, 48, 49, 50, 213, 124, 35, 54, 55, 56, 273, 184, 95, 60, 16, 26, 63, 64, 155, 66, 76, 284, 96, 70, 17, 72
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 06 2002

Keywords

Comments

The range of A007500 is a subset of the range of this sequence. - Reinhard Zumkeller, Jul 06 2009
Prime factors counted with multiplicity. - Harvey P. Dale, Jul 08 2017

Examples

			a(143) = a(11*13) = a(11)*a(13) = 11*31 = 341.
		

Crossrefs

Cf. A151764, A161594, A151765. For records see A151766, A151767.
Cf. A151768 (complement), A376858 (fixed points).
Cf. A027746.

Programs

  • Haskell
    a071786 = product . map a004086 . a027746_row
    -- Reinhard Zumkeller, Oct 14 2011
    
  • Maple
    read("transforms") ; A071786 := proc(n) local ifs, a, d ; ifs := ifactors(n)[2] ; a := 1 ; for d in ifs do a := a*digrev(op(1, d))^op(2, d) ; od: a ; end: # R. J. Mathar, Jun 16 2009
    # second Maple program:
    r:= n-> (s-> parse(cat(seq(s[-i], i=1..length(s)))))(""||n):
    a:= n-> mul(r(i[1])^i[2], i=ifactors(n)[2]):
    seq(a(n), n=1..100);  # Alois P. Heinz, Jun 19 2017
  • Mathematica
    Table[Times@@IntegerReverse/@Flatten[Table[#[[1]],#[[2]]]&/@ FactorInteger[ n]],{n,80}] (* Harvey P. Dale, Jul 08 2017 *)
  • PARI
    rev(n)=fromdigits(Vecrev(digits(n)))
    a(n)=my(f=factor(n)); prod(i=1,#f~,rev(f[i,1])^f[i,2]) \\ Charles R Greathouse IV, Jun 28 2015
  • Python
    from sympy import factorint
    from operator import mul
    from functools import reduce
    def A071786(n):
        return 1 if n==1 else reduce(mul,(int(str(p)[::-1])**e for p,e in factorint(n).items())) # Chai Wah Wu, Aug 14 2014
    

Formula

Completely multiplicative with a(p) = A004086(p), p prime.
a(A000040(n)) = A004087(n).

A133019 Product of n-th prime and n-th prime written backwards.

Original entry on oeis.org

4, 9, 25, 49, 121, 403, 1207, 1729, 736, 2668, 403, 2701, 574, 1462, 3478, 1855, 5605, 976, 5092, 1207, 2701, 7663, 3154, 8722, 7663, 10201, 31003, 75007, 98209, 35143, 91567, 17161, 100147, 129409, 140209, 22801, 117907, 58843, 127087
Offset: 1

Views

Author

Omar E. Pol, Oct 27 2007

Keywords

Comments

a(8) = 1729 is the second taxicab number, also called the Hardy-Ramanujan number (see A001235, A011541 and A133029).

Examples

			a(8) = 1729 because the 8th prime is 19 and 19 written backwards is 91 and 19*91 = 1729.
		

Crossrefs

Programs

  • Mathematica
    #*FromDigits[Reverse[IntegerDigits[#]]] & /@ Prime[Range[1, 50]] (* G. C. Greubel, Oct 02 2017 *)
    #*IntegerReverse[#]&/@Prime[Range[40]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 29 2021 *)
  • PARI
    vector(60, n, prime(n)*subst(Polrev(digits(prime(n))), x, 10)) \\ Michel Marcus, Dec 17 2014

Formula

a(n) = A000040(n) * A004087(n)

A086002 Primes which when added to their own rotation yield a prime.

Original entry on oeis.org

229, 239, 241, 257, 269, 271, 277, 281, 439, 443, 463, 467, 479, 499, 613, 641, 653, 661, 673, 677, 683, 691, 811, 823, 839, 863, 881, 10111, 10151, 10169, 10181, 10243, 10247, 10253, 10267, 10303, 10313, 10331, 10343, 10391, 10429, 10453, 10457
Offset: 1

Views

Author

Chuck Seggelin, Jul 07 2003

Keywords

Comments

Let rotation rot(k) of a number k be defined by swapping the blocks of the first [d/2] and of the last [d/2] digits of k, where d=A055642(k). If the number of digits in k is odd, the center digit remains untouched during rotation.
So for example the rotation of 1234 is 3412, while the rotation of 12345 is 45312.
Rotation differs from reversal (A004086) for numbers with at least 4 digits, that is, after A004087(168) if we are concerned with primes.
The sequence lists primes p such that p+rot(p) is (again) prime.
Differs from A061783, where rot(k) is replaced by reverse(k), from the 5-digit terms on. - M. F. Hasler, Mar 03 2011
a(n) has an odd number of digits (see RJM comment in A086004). If a(n) has 2m+1 digits, then the m-th digit of a(n) is even as otherwise a(n) + rot(a(n)) is even. - Chai Wah Wu, Aug 19 2015

Examples

			a(100)=12917 because (i) 12917 is prime and (ii) rotate(12917) = 17912 and 12917+17912=30829, which is also prime.
		

Crossrefs

Programs

  • Maple
    A055642 := proc(n) max(1,1+ilog10(n)) ; end:
    rot := proc(n) local d,dl,dh,pre,suf ; d := A055642(n) ; dl := floor( d/2) ; dh := floor( (d+1)/2) ; pre := floor(n/10^dh) ; suf := n mod 10^dl ; if dl <> dh then suf*10^dh+pre+10^dl*( floor(n/10^dl) mod 10) ; else suf*10^dh+pre ; fi; end:
    isA086002 := proc(p) if isprime(p) then isprime(p+rot(p)) ; else false; fi; end:
    for n from 1 to 1500 do p := ithprime(n) ; if isA086002(p) then printf("%d,",p) ; fi; od: # R. J. Mathar, May 27 2009
  • Mathematica
    rot[n_]:=Module[{idn=IntegerDigits[n],len},len=Length[idn];If[OddQ[len],FromDigits[ Join[Take[idn,-Floor[len/2]],{idn[[(len+1)/2]]},Take[idn,Floor[len/2]]]],FromDigits[ Join[ Take[ idn,-len/2],Take[idn,len/2]]]]]; Select[Prime[Range[1500]],PrimeQ[ #+rot[#]]&] (* Harvey P. Dale, Apr 26 2022 *)

Extensions

Edited by R. J. Mathar, May 27 2009

A188649 Least common multiple of reversals of divisors of n in decimal representation.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 84, 31, 574, 255, 488, 71, 162, 91, 20, 84, 22, 32, 168, 260, 62, 72, 1148, 92, 510, 13, 11224, 33, 6106, 1855, 2268, 73, 15106, 93, 40, 14, 6888, 34, 44, 4590, 64, 74, 10248, 658, 260, 1065, 3100, 35, 3240, 55, 149240, 6825, 7820, 95, 7140, 16, 26, 252, 11224, 8680, 66, 76, 12212, 96, 152110, 17, 4536, 37, 6862, 251940, 2024204, 77
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 11 2011

Keywords

Examples

			Divisors(42) = {1,2,3,6,7,14,21,42}, therefore a(42) = lcm(1,2,3,6,7,41,12,24) = 6888.
		

Crossrefs

Cf. A003990 (LCM), A027750 (divisors), A004086 (reversal), A188650.

Programs

  • Haskell
    a188649 n = foldl lcm 1 $ map a004086 $ filter ((== 0) . mod n) [1..n]
    
  • PARI
    a(n) = lcm(apply(x->fromdigits(Vecrev(digits(x))), divisors(n))); \\ Michel Marcus, Mar 13 2018
    
  • Python
    from math import lcm
    from sympy import divisors
    def a(n): return lcm(*(int(str(d)[::-1]) for d in divisors(n)))
    print([a(n) for n in range(1, 78)]) # Michael S. Branicky, Aug 14 2022

Formula

a(A000040(n)) = A004087(n);
a(A002385(n)) = A002385(n), see A188650 for all fixed points.

A166501 Primes p such that (p reversed)+4 is also a prime.

Original entry on oeis.org

3, 7, 31, 73, 79, 97, 313, 331, 349, 379, 397, 541, 571, 709, 739, 757, 769, 937, 967, 3037, 3061, 3067, 3121, 3163, 3187, 3217, 3229, 3253, 3313, 3319, 3361, 3433, 3457, 3529, 3547, 3613, 3631, 3643, 3673, 3739, 3769, 3847, 3889, 5011, 5023, 5101, 5107
Offset: 1

Views

Author

Vincenzo Librandi, Oct 15 2009

Keywords

Examples

			73 is in the sequence because 37+4=41 prime.
331 is in the sequence because 133+4=137 prime.
3457 is in the sequence because 7543+4=7547 prime.
		

Programs

  • Magma
    [p: p in PrimesUpTo(6000) | IsPrime(q+4) where q is Seqint(Reverse(Intseq(p)))]; // Vincenzo Librandi, Sep 15 2013
  • Mathematica
    Select[Prime[Range[700]],PrimeQ[FromDigits[Reverse[IntegerDigits[#]]]+ 4]&] (* Harvey P. Dale, May 21 2012 *)
    Select[Prime[Range[700]],PrimeQ[IntegerReverse[#]+4]&] (* Harvey P. Dale, Mar 16 2023 *)

Formula

{p = A000040(i): A004087(i)+4 in A000040}. - R. J. Mathar, Oct 16 2009

Extensions

Keyword:base added, 3163 inserted, sequence extended by R. J. Mathar, Oct 16 2009

A068396 n-th prime minus its reversal.

Original entry on oeis.org

0, 0, 0, 0, 0, -18, -54, -72, -9, -63, 18, -36, 27, 9, -27, 18, -36, 45, -9, 54, 36, -18, 45, -9, 18, 0, -198, -594, -792, -198, -594, 0, -594, -792, -792, 0, -594, -198, -594, -198, -792, 0, 0, -198, -594, -792, 99, -99, -495
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 08 2002

Keywords

Comments

a(n) = 0 for n in A075807. - Michel Marcus, Sep 27 2017
All terms are divisible by 9. - Zak Seidov, Jun 05 2021

Examples

			a(10) = 29 - 92 = -63;
a(20) = 71 - 17 = 54.
		

Crossrefs

Programs

  • Haskell
    a068396 n = p - a004086 p  where p = a000040 n
    -- Reinhard Zumkeller, Feb 04 2014
    
  • Mathematica
    #-IntegerReverse[#]& /@ Prime[Range[50]] (* Harvey P. Dale, Dec 20 2012 *)
  • PARI
    a(n) = prime(n) - fromdigits(Vecrev(digits(prime(n)))); \\ Michel Marcus, Sep 27 2017
    
  • Python
    from sympy import prime
    def a(n): pn = prime(n); return pn - int(str(pn)[::-1])
    print([a(n) for n in range(1, 50)]) # Michael S. Branicky, Jun 05 2021

Formula

a(n) = A000040(n) - A004087(n).
a(n) = A056965(A000040(n)). - Michel Marcus, Sep 27 2017

A061227 a(n) = p + R(p) where R(p) is the digit reversal of n-th prime p.

Original entry on oeis.org

4, 6, 10, 14, 22, 44, 88, 110, 55, 121, 44, 110, 55, 77, 121, 88, 154, 77, 143, 88, 110, 176, 121, 187, 176, 202, 404, 808, 1010, 424, 848, 262, 868, 1070, 1090, 302, 908, 524, 928, 544, 1150, 362, 382, 584, 988, 1190, 323, 545, 949, 1151, 565, 1171, 383
Offset: 0

Views

Author

Amarnath Murthy, Apr 22 2001

Keywords

Examples

			a(4) = 14 = 7 + 7, 7 is the fourth prime; a(8) = 110 = 19 + 91, 19 is the eighth prime.
		

Crossrefs

Programs

  • Haskell
    a061227 n = p + a004086 p  where p = a000040 n
    -- Reinhard Zumkeller, Feb 04 2014
  • Maple
    revdigs:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(10^(nops(L)-j)*L[j],j=1..nops(L))
    end proc:
    seq(x+revdigs(x),x=select(isprime,[2,seq(i,i=3..1000,2); # Robert Israel, May 23 2016
  • Mathematica
    #+FromDigits[Reverse[IntegerDigits[#]]]&/@Prime[Range[60]] (* Harvey P. Dale, Jul 13 2013 *)

Formula

a(n) = A000040(n) + A004087(n). - Reinhard Zumkeller, Feb 04 2014
a(n) = A056964(A000040(n)). - Robert Israel, May 23 2016

Extensions

More terms from Patrick De Geest, Jun 04 2001

A071602 Sum of the reverses of the first n primes.

Original entry on oeis.org

2, 5, 10, 17, 28, 59, 130, 221, 253, 345, 358, 431, 445, 479, 553, 588, 683, 699, 775, 792, 829, 926, 964, 1062, 1141, 1242, 1543, 2244, 3145, 3456, 4177, 4308, 5039, 5970, 6911, 7062, 7813, 8174, 8935, 9306, 10277, 10458, 10649, 11040, 11831
Offset: 1

Views

Author

Joseph L. Pe, Jun 02 2002

Keywords

Examples

			a(6) = reverse(2) + reverse(3) + reverse(5) + reverse(7) + reverse(11) + reverse(13) = 2 + 3 + 5 + 7 + 11 + 31 = 59.
		

Crossrefs

Partial sums of A004087.

Programs

  • Maple
    rev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    ListTools:-PartialSums(map(rev, [seq(ithprime(i),i=1..200)])); # Robert Israel, Feb 17 2025
  • Mathematica
    f[n_] := Sum[ FromDigits[ Reverse[ IntegerDigits[Prime[i]]]], {i, 1, n}]; Table[ f[n], {n, 1, 50}]
    Accumulate[FromDigits[Reverse[IntegerDigits[ #]]] & /@ Prime[Range[ 50]]]  (* Harvey P. Dale, Jan 27 2011 *)
    Accumulate[IntegerReverse[Prime[Range[50]]]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Oct 10 2020 *)
  • PARI
    a(k) = my(v=primes(n)); sum(i=1, n, fromdigits(Vecrev(digits(v[i])))); \\ Michel Marcus, Feb 17 2025
  • Python
    from sympy import primerange
    from itertools import accumulate
    print(list(accumulate(int(str(p)[::-1]) for p in primerange(2, 198)))) # Michael S. Branicky, Jun 24 2022
    

Extensions

Edited by Robert G. Wilson v, Jun 07 2002

A095180 Reverse digits of primes, append to sequence if result is a prime.

Original entry on oeis.org

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

Views

Author

Cino Hilliard, Jun 21 2004

Keywords

Comments

Conjecture: the Benford law limit is 2=Sum[N[Log[10, 1 + 1/d[[n]]]], {n, 1, Length[d]}]^2/(( #totalprimes/#totalPrimes)). At 50000 primes total it is 2.05931. - Roger L. Bagula and Gary W. Adamson, Jul 02 2008
Presumably this does not satisfy Benford's law. - N. J. A. Sloane, Feb 09 2017

Examples

			The prime 107 in reverse is 701 which is prime.
		

Crossrefs

Programs

  • Haskell
    a095180 n = a095180_list !! (n-1)
    a095180_list =filter ((== 1) . a010051) a004087_list
    -- Reinhard Zumkeller, Oct 14 2011
  • Mathematica
    b = Flatten[Table[If[PrimeQ[Sum[IntegerDigits[Prime[n]][[i]]*10^(i - 1), {i, 1, Length[IntegerDigits[Prime[n]]]}]], Sum[IntegerDigits[Prime[n]][[i]]*10^(i - 1), {i, 1, Length[IntegerDigits[Prime[n]]]}], {}], {n, 1,1000}]] (* Roger L. Bagula and Gary W. Adamson, Jul 02 2008 *)
    Select[FromDigits[Reverse[IntegerDigits[#]]]&/@Prime[Range[300]],PrimeQ] (* Harvey P. Dale, May 05 2015 *)
  • PARI
    r(n) = forprime(x=1,n,y=eval(rev(x));if(isprime(y),print1(y","))) \ Get the reverse of the input string rev(str) = { local(tmp,j,s); tmp = Vec(Str(str)); s=""; forstep(j=length(tmp),1,-1, s=concat(s,tmp[j])); return(s) }
    
Showing 1-10 of 35 results. Next