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.

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