login
A117462
The number of doubling steps of SOD(n) to exceed or equal n.
3
1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, 2, 2, 2, 2, 2, 2, 1, 1, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 4
OFFSET
1,10
COMMENTS
"SOD" = "sum of digits".
FORMULA
Take n, calculate SOD, and count doubling iterations (at least 1) to equal or exceed n.
a(n) = max(1, log_2(n/A007953(n))). - R. J. Mathar, Sep 24 2018
EXAMPLE
a(10) = 4. SOD(10)=1. 1 doubled is 2. Iterating: 2,4,8,16 -- 4 iterations of doubling 1 to exceed 10.
MAPLE
A117462 := proc(n)
local x;
x := digsum(n) ;
max(1, ceil(log[2](n/x))) ;
end proc:
seq(A117462(n), n=1..90) ; # R. J. Mathar, Sep 24 2018
MATHEMATICA
Array[Max[1, Ceiling@ Log2[#/Total@ IntegerDigits@ #]] &, 105] (* Michael De Vlieger, Sep 24 2018 *)
PROG
(BASIC)
10 'use of str, mid, len, val
20 'number of doubled iterations required to equal or exceed sod(n)
30 C=C+1
40 D=str(C)
50 E=len(D)
60 for Q=2 to E
70 A=mid(D, Q, 1):G=val(A)
80 I=I+G
90 next Q
100 print C; I; "-";
110 K=I
120 I=0
130 for R=1 to C
140 K=K+K:T=T+1
150 if K>=C then print C; K; T:cancel for:stop:goto 170
160 next R
170 K=0:T=0
180 goto 30
CROSSREFS
Sequence in context: A237524 A266143 A171623 * A155462 A109496 A138851
KEYWORD
easy,nonn,base
AUTHOR
Enoch Haga, Mar 18 2006
EXTENSIONS
Re-engineered definition from BASIC program, and corrected/clarified the terms. - R. J. Mathar, Sep 24 2018
STATUS
approved