# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a028897
Showing 1-1 of 1
%I A028897 #44 Jun 20 2023 17:03:06
%S A028897 0,1,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,10,11,4,5,6,7,8,9,10,11,12,13,6,
%T A028897 7,8,9,10,11,12,13,14,15,8,9,10,11,12,13,14,15,16,17,10,11,12,13,14,
%U A028897 15,16,17,18,19,12,13,14,15,16,17,18,19,20,21,14,15,16,17,18,19,20,21,22,23,16,17,18,19,20,21,22,23,24,25,18,19,20,21,22,23,24,25,26,27,4
%N A028897 If n = Sum c_i 10^i then a(n) = Sum c_i 2^i.
%C A028897 For n<100, this is the same result as "If n = Sum c_i 10^i then a(n) = Sum c_i (i+1)". - _Henry Bottomley_, Apr 20 2001
%C A028897 n_2 in the notation of A122618.
%C A028897 Left inverse of A007088 (binary numbers), cf. formula from Karttunen. - _M. F. Hasler_, Jun 13 2023
%H A028897 Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
%H A028897 Robin C. Yu, Decibinary Numbers, on Hackerrank.com.
%H A028897 Index entries for sequences related to decimal expansion of n
%F A028897 a(n) = 2*a(floor(n/10)) + (n mod 10). - _Henry Bottomley_, Apr 20 2001
%F A028897 a(0) = 0, a(n) = 2*a(n/10) if n == 0 (mod 10), a(n) = a(n-1)+1 otherwise. - _Benoit Cloitre_, Dec 21 2002
%F A028897 For all n, a(A007088(n)) = n. - _Antti Karttunen_, Jun 22 2014
%t A028897 a[n_ /; n < 10] := n; a[n_] := a[n] = If[Mod[n, 10] != 0, a[n-1] + 1, 2*a[n/10]]; Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Apr 02 2016 *)
%o A028897 (PARI) a(n)=if(n<1,0,if(n%10,a(n-1)+1,2*a(n/10)))
%o A028897 (PARI) A028897(n)=fromdigits(digits(n),2) \\ _M. F. Hasler_, Feb 14 2019
%o A028897 (MIT/GNU Scheme) (define (A028897 n) (let loop ((z 0) (i 0) (n n)) (if (zero? n) z (loop (+ z (* (modulo n 10) (expt 2 i))) (1+ i) (floor->exact (/ n 10)))))) ;; _Antti Karttunen_, Jun 22 2014
%o A028897 (Haskell)
%o A028897 a028897 0 = 0
%o A028897 a028897 n = 2 * a028897 n' + d where (n', d) = divMod n 10
%o A028897 -- _Reinhard Zumkeller_, Nov 06 2014
%Y A028897 Cf. A007088, A122618.
%Y A028897 Differs from A081594 and A244158 for the first time at n = 100, which here is a(100) = 4.
%Y A028897 Cf. A249873, A072170.
%Y A028897 See A322000 for integers ordered according to the value of a(n).
%K A028897 nonn,base,easy,nice,look
%O A028897 0,3
%A A028897 _N. J. A. Sloane_
%E A028897 More terms from _Erich Friedman_.
%E A028897 Terms up to n = 100 added by _Antti Karttunen_, Jun 22 2014
# Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE