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

A056965 a(n) = n - (reversal of digits of n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, -9, -18, -27, -36, -45, -54, -63, -72, 18, 9, 0, -9, -18, -27, -36, -45, -54, -63, 27, 18, 9, 0, -9, -18, -27, -36, -45, -54, 36, 27, 18, 9, 0, -9, -18, -27, -36, -45, 45, 36, 27, 18, 9, 0, -9, -18, -27, -36, 54, 45, 36, 27, 18, 9, 0, -9, -18, -27, 63, 54, 45, 36, 27, 18, 9, 0, -9, -18, 72, 63, 54
Offset: 0

Views

Author

Henry Bottomley, Jul 18 2000

Keywords

Comments

a(n) is a multiple of 9.

Examples

			a(17) = 17 - 71 = -54.
		

Crossrefs

Programs

  • Haskell
    a056965 n = n - a004086 n  -- Reinhard Zumkeller, Sep 17 2013
    
  • Maple
    a:= n-> (s-> n-parse(cat(s[-i]$i=1..length(s))))(""||n):
    seq(a(n), n=0..82);  # Alois P. Heinz, Jul 11 2021
  • Mathematica
    Table[n - FromDigits[Reverse[IntegerDigits[n]]], {n, 0, 82}] (* Jayanta Basu, Jul 11 2013 *)
  • PARI
    a(n) = n - fromdigits(Vecrev(digits(n))); \\ Michel Marcus, Dec 20 2023
  • Python
    def a(n): return n - int(str(n)[::-1]) # Osman Mustafa Quddusi, Jul 11 2021
    

Formula

a(n) = n - A004086(n) = 2*n - A056964(n).

A055945 a(n) = n - (reversal of base-2 digits of n) (and then the result is written in base 10).

Original entry on oeis.org

0, 0, 1, 0, 3, 0, 3, 0, 7, 0, 5, -2, 9, 2, 7, 0, 15, 0, 9, -6, 15, 0, 9, -6, 21, 6, 15, 0, 21, 6, 15, 0, 31, 0, 17, -14, 27, -4, 13, -18, 35, 4, 21, -10, 31, 0, 17, -14, 45, 14, 31, 0, 41, 10, 27, -4, 49, 18, 35, 4, 45, 14, 31, 0, 63, 0, 33, -30, 51, -12, 21, -42, 63, 0, 33, -30, 51, -12, 21, -42, 75, 12, 45, -18, 63, 0, 33, -30, 75, 12, 45
Offset: 0

Views

Author

Henry Bottomley, Jul 18 2000

Keywords

Comments

a(n) is even if n is odd and a(n) is odd if n is even; this is caused by the kind of swapping the most significant and least significant binary digit when reversing n and the fact that the most significant digit of n is always 1. - R. J. Mathar, Nov 05 2015

Crossrefs

Programs

  • Maple
    a:= proc(n) local m, r; m:=n; r:=0;
          while m>0 do r:= r*2 +irem(m, 2, 'm') od;
          n-r
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Jul 02 2015
  • Mathematica
    Array[# - IntegerReverse[#, 2] &, 90, 0] (* Michael De Vlieger, Sep 06 2019 *)

Formula

For 2^m <= n <= 2^(m+1), we have n - 2^(m+1) <= a(n) <= n. - N. J. A. Sloane, May 29 2016
a(n) = n - A030101(n).

A309574 n-th prime minus its ternary (base 3) reversal.

Original entry on oeis.org

0, 2, -2, 2, -8, 0, -8, 8, 0, -26, -6, 6, -26, -6, -14, -26, -6, 14, 26, -6, 38, 26, -80, -128, -48, -80, -24, -128, 24, -80, 24, -80, -32, 24, -56, 0, 24, 80, -24, 0, -48, 80, 24, 80, -24, 104, 80, 80, 48, 104, 0, 24, 80, -398, -338, -278, -434, 18, -138
Offset: 1

Views

Author

Keywords

Comments

a(n) = 0 if and only if n is palindromic in base 3 - if and only if A000040(n) is in A014190.
As it occurs in its binary cousin, we observe that a scatter plot of this sequence shows parallelograms.
All terms are even. - Alois P. Heinz, Aug 08 2019

Crossrefs

Programs

  • Maple
    a:= n-> (p-> p-(l->add(l[-i]*3^(i-1), i=1..nops(l))
            )(convert(p, base, 3)))(ithprime(n)):
    seq(a(n), n=1..61);  # Alois P. Heinz, Aug 08 2019
  • Mathematica
    (# - IntegerReverse[#,3]) &@ Prime@ Range@ 60 (* Giovanni Resta, Aug 09 2019 *)
  • PARI
    a(n) = my(p=prime(n)); p - fromdigits(Vecrev(digits(p, 3)), 3); \\ Michel Marcus, Aug 09 2019
  • Python
    from sympy import primerange
    def rev(n, b):
        m = 0
        while n > 0:
            m, n = m*b+n%b, n//b
        return m
    n, aa = 1, 1
    while n <20:
        if aa in primerange(1,200):
            print(n, aa-rev(aa, 3))
            n = n+1
        aa = aa+1 # A.H.M. Smeets, Aug 09 2019
    

Formula

a(n) = A000040(n) - A030102(A000040(n)).
a(n) = A055947(A000040(n)).
Showing 1-3 of 3 results.