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!)
A260112 Minimal number of steps to get from 0 to n by (a) adding 1 or (b) multiplying by 4. 4
0, 1, 2, 3, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7, 3, 4, 5, 6, 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10, 8, 9, 10, 11, 4, 5, 6, 7, 5, 6, 7, 8, 6, 7, 8, 9, 7, 8, 9, 10, 5, 6, 7, 8, 6 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
a(n) = (Weight of quaternary expansion of n) + (length of quaternary expansion of n) - 1.
LINKS
FORMULA
a(n) = A053737(n) + A110591(n) - 1. - Michel Marcus, Jul 17 2015
EXAMPLE
For a(308) = 9, the nine steps are: 308 => 77 => 76 => 19 => 18 => 17 => 16 => 4 => 1 => 0.
MAPLE
a:= n-> (l-> nops(l)+add(i, i=l)-1)(convert(n, base, 4)):
seq(a(n), n=0..105); # Alois P. Heinz, Jul 16 2015
PROG
(Ruby) def a(n); n.to_s(4).length + n.to_s(4).split('').map(&:to_i).reduce(:+) - 1 end
(PARI) a(n)=sumdigits(n, 4)+#digits(n, 4)-1 \\ Charles R Greathouse IV, Jul 16 2015
(Haskell)
c i = if i `mod` 4 == 0 then i `div` 4 else i - 1
b 0 foldCount = foldCount
b sheetCount foldCount = b (c sheetCount) (foldCount + 1)
a260112 n = b n 0 -- Peter Kagey, Sep 02 2015
CROSSREFS
Analogous sequences with a different multiplier k: A056792 (k=2), A061282 (k=3).
Cf. A053737, A110591, A007090: base 4 sequences.
Sequence in context: A286534 A324532 A324390 * A361838 A213183 A125929
KEYWORD
nonn,easy
AUTHOR
Peter Kagey, Jul 16 2015
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 April 23 02:23 EDT 2024. Contains 371906 sequences. (Running on oeis4.)