login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A007089 Numbers in base 3.
(Formerly M1960)
326
0, 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102, 110, 111, 112, 120, 121, 122, 200, 201, 202, 210, 211, 212, 220, 221, 222, 1000, 1001, 1002, 1010, 1011, 1012, 1020, 1021, 1022, 1100, 1101, 1102, 1110, 1111, 1112, 1120, 1121, 1122, 1200, 1201, 1202, 1210, 1211 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Nonnegative integers with no decimal digit > 2. Thus nonnegative integers in base 10 whose quadrupling by normal addition or multiplication requires no carry operation. - Rick L. Shepherd, Jun 25 2009
REFERENCES
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
The Unicode Consortium, Tai Xuan Jing Symbols
Eric Weisstein's World of Mathematics, Ternary.
FORMULA
a(0)=0, a(n) = 10*a(n/3) if n==0 (mod 3), a(n) = a(n-1) + 1 otherwise. - Benoit Cloitre, Dec 22 2002
a(n) = 10*a(floor(n/3)) + (n mod 3) if n > 0, a(0) = 0. - M. F. Hasler, Feb 15 2023
MAPLE
A007089 := proc(n) option remember;
if n <= 0 then 0
else
if (n mod 3) = 0 then 10*procname(n/3) else procname(n-1) + 1 fi
fi end:
[seq(A007089(n), n=0..729)]; # - N. J. A. Sloane, Mar 09 2019
MATHEMATICA
Table[ FromDigits[ IntegerDigits[n, 3]], {n, 0, 50}]
PROG
(PARI) a(n)=if(n<1, 0, if(n%3, a(n-1)+1, 10*a(n/3)))
(PARI) a(n)=fromdigits(digits(n, 3)) \\ Charles R Greathouse IV, Jan 08 2017
(Haskell)
a007089 0 = 0
a007089 n = 10 * a007089 n' + m where (n', m) = divMod n 3
-- Reinhard Zumkeller, Feb 19 2012
(Python)
def A007089(n):
n, s = divmod(n, 3); t = 1
while n: n, r = divmod(n, 3); t *= 10; s += r*t
return s # M. F. Hasler, Feb 15 2023
CROSSREFS
Primes when read as if in base 10: A036954.
Sequence in context: A217072 A106518 A158304 * A159952 A136820 A256437
KEYWORD
base,nonn,easy
AUTHOR
EXTENSIONS
More terms from James A. Sellers, May 01 2000
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 18 22:09 EDT 2024. Contains 370951 sequences. (Running on oeis4.)