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.

A260112 Minimal number of steps to get from 0 to n by (a) adding 1 or (b) multiplying by 4.

This page as a plain text file.
%I A260112 #21 Sep 02 2015 12:41:41
%S A260112 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,
%T A260112 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,
%U A260112 6,7,5,6,7,8,6,7,8,9,7,8,9,10,5,6,7,8,6
%N A260112 Minimal number of steps to get from 0 to n by (a) adding 1 or (b) multiplying by 4.
%C A260112 a(n) = (Weight of quaternary expansion of n) + (length of quaternary expansion of n) - 1.
%H A260112 Peter Kagey, <a href="/A260112/b260112.txt">Table of n, a(n) for n = 0..10000</a>
%F A260112 a(n) = A053737(n) + A110591(n) - 1. - _Michel Marcus_, Jul 17 2015
%e A260112 For a(308) = 9, the nine steps are: 308 => 77 => 76 => 19 => 18 => 17 => 16 => 4 => 1 => 0.
%p A260112 a:= n-> (l-> nops(l)+add(i, i=l)-1)(convert(n, base, 4)):
%p A260112 seq(a(n), n=0..105);  # _Alois P. Heinz_, Jul 16 2015
%o A260112 (Ruby) def a(n); n.to_s(4).length + n.to_s(4).split('').map(&:to_i).reduce(:+) - 1 end
%o A260112 (PARI) a(n)=sumdigits(n,4)+#digits(n,4)-1 \\ _Charles R Greathouse IV_, Jul 16 2015
%o A260112 (Haskell)
%o A260112 c i = if i `mod` 4 == 0 then i `div` 4 else i - 1
%o A260112 b 0 foldCount = foldCount
%o A260112 b sheetCount foldCount = b (c sheetCount) (foldCount + 1)
%o A260112 a260112 n = b n 0 -- _Peter Kagey_, Sep 02 2015
%Y A260112 Analogous sequences with a different multiplier k: A056792 (k=2), A061282 (k=3).
%Y A260112 Cf. A053737, A110591, A007090:  base 4 sequences.
%K A260112 nonn,easy
%O A260112 0,3
%A A260112 _Peter Kagey_, Jul 16 2015