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!)
A061282 Minimal number of steps to get from 0 to n by (a) adding 1 or (b) multiplying by 3. A stopping problem: begin with n and at each stage if a multiple of 3 divide by 3, otherwise subtract 1. 4
0, 1, 2, 2, 3, 4, 3, 4, 5, 3, 4, 5, 4, 5, 6, 5, 6, 7, 4, 5, 6, 5, 6, 7, 6, 7, 8, 4, 5, 6, 5, 6, 7, 6, 7, 8, 5, 6, 7, 6, 7, 8, 7, 8, 9, 6, 7, 8, 7, 8, 9, 8, 9, 10, 5, 6, 7, 6, 7, 8, 7, 8, 9, 6, 7, 8, 7, 8, 9, 8, 9, 10, 7, 8, 9, 8, 9, 10, 9, 10, 11, 5, 6, 7, 6, 7, 8, 7, 8, 9, 6, 7, 8, 7, 8, 9, 8, 9, 10, 7, 8 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
n > 0 occurs A001590(n+2) times in this sequence. - Peter Kagey, Jul 19 2015
a(n) gives the number of iterations of A260316 to reach 0. - Peter Kagey, Jul 22 2015
LINKS
FORMULA
a(n) = A062153(n) + A053735(n) = (number of base 3 digits of n) + (sum of base 3 digits of n)-1. a(3n) = a(n)+1, a(3n+1) = a(n)+2, a(3n+2) = a(n)+3; a(0)=0, a(1)=1, a(2)=2.
EXAMPLE
a(25)=7 since 25=((0+1+1)*3+1+1)*3+1.
MAPLE
a:= n-> (l-> nops(l)+add(i, i=l)-1)(convert(n, base, 3)):
seq(a(n), n=0..105); # Alois P. Heinz, Jul 16 2015
PROG
(PARI) a(n)=sumdigits(n, 3)+#digits(n, 3)-1 \\ Charles R Greathouse IV, Jul 16 2015
(Haskell)
c i = if i `mod` 3 == 0 then i `div` 3 else i - 1
b 0 foldCount = foldCount
b sheetCount foldCount = b (c sheetCount) (foldCount + 1)
a061282 n = b n 0 -- Peter Kagey, Sep 02 2015
CROSSREFS
Analogous sequences with a different multiplier k: A056792 (k=2), A260112 (k=4).
Sequence in context: A199408 A285325 A135529 * A244040 A338913 A328803
KEYWORD
nonn,easy
AUTHOR
Henry Bottomley, Jun 06 2001
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 28 14:38 EDT 2024. Contains 371254 sequences. (Running on oeis4.)