login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A030102 Base-3 reversal of n (written in base 10). 30
0, 1, 2, 1, 4, 7, 2, 5, 8, 1, 10, 19, 4, 13, 22, 7, 16, 25, 2, 11, 20, 5, 14, 23, 8, 17, 26, 1, 28, 55, 10, 37, 64, 19, 46, 73, 4, 31, 58, 13, 40, 67, 22, 49, 76, 7, 34, 61, 16, 43, 70, 25, 52, 79, 2, 29, 56, 11, 38, 65, 20, 47, 74, 5, 32, 59, 14, 41, 68, 23, 50, 77, 8, 35, 62, 17, 44, 71 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 0..10000

Michael Gilleland, Some Self-Similar Integer Sequences

Lukas Spiegelhofer, A digit reversal property for an analogue of Stern's sequence, arXiv:1709.05651 [math.NT], 2017. See Theorem 1.1.

FORMULA

a(n) = t(n,0) with t(n,r) = if n=0 then r else t(floor(n/3),r*3+(n mod 3)). - Reinhard Zumkeller, Mar 04 2010

G.f. G(x) satisfies: G(x) = (1+x+x^2)*G(x^3) - (1+2*x)*(x + 2*Sum_{m>=0} 3^m*x^(3^(m+1)+1)/(x^3-1). - Robert Israel, Dec 24 2015

EXAMPLE

a(17) = 25 because 17 in base 3 is 122, and backwards that is 221, which is 25 in base 10.

a(18) = 2 because 18 in base 3 is 200, and backwards that is 2.

MAPLE

a030102:= proc(n) option remember;

  local y;

  y:= n mod 3;

  3^ilog[3](n)*y + procname((n-y)/3)

end proc:

for i from 0 to 2 do a030102(i):= i od:

seq(a030102(i), i=0..100); # Robert Israel, Dec 24 2015

# alternative

A030102 := proc(n)

    local r ;

    r := ListTools[Reverse](convert(n, base, 3)) ;

    add(op(i, r)*3^(i-1), i=1..nops(r)) ;

end proc: # R. J. Mathar, May 28 2016

MATHEMATICA

A030102[n_] := FromDigits[Reverse@IntegerDigits[n, 3], 3] (* JungHwan Min, Dec 23 2015 *)

PROG

(PARI) a(n, b=3)=subst(Polrev(base(n, b)), x, b)) /* where */

base(n, b)={my(a=[n%b]); while(0<n\=b, a=concat(n%b, a)); a}  \\ M. F. Hasler, Nov 04 2011

(PARI) a(n) = fromdigits(Vecrev(digits(n, 3)), 3); \\ Michel Marcus, Oct 10 2017

(Haskell)

a030102 = foldl (\v d -> 3 * v + d) 0 . a030341_row

-- Reinhard Zumkeller, Dec 16 2013

CROSSREFS

Cf. A134028, A030101 - A030108, A004086, A134028.

Cf. A030341.

Cf. A263273 for a bijective variant.

Sequence in context: A091320 A225468 A048787 * A072010 A255588 A123360

Adjacent sequences:  A030099 A030100 A030101 * A030103 A030104 A030105

KEYWORD

nonn,base,look

AUTHOR

David W. Wilson

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 24 18:52 EDT 2019. Contains 326295 sequences. (Running on oeis4.)