login
Sum of b(i) where the first b terms are all k digits of n, followed by Keith-like sum of the previous k digits until b(i) >= n
0

%I #17 Mar 26 2023 11:36:10

%S 34,33,32,44,33,40,47,54,61,39,68,75,66,86,64,76,88,100,66,73,102,96,

%T 129,99,119,139,96,108,120,132,136,117,150,112,132,152,172,116,128,

%U 140,170,138,171,204,145,165,185,205,225,148,204,159,192,225,258,178

%N Sum of b(i) where the first b terms are all k digits of n, followed by Keith-like sum of the previous k digits until b(i) >= n

%C Similar to the concept of (but not limited to) Keith numbers, form a sequence {b(i)} whose initial terms are the t digits of n, later terms given by the rule that b(i) = sum of t previous terms, until b(i) >= n.

%C Originally, the concept of Keith numbers did not include n < 10. This sequence follows this rule; however, a(n) is mathematically possible for n < 10: a(n) = n.

%e For n = 15, the sequence is {1, 5, 6, 11, 17} (the first two terms being each of the two digits of 15 and the sequence stops at 17 because this is the first number that is at least n). So, a(15) = 1 + 5 + 6 + 11 + 17 = 40.

%o (Ruby)

%o def a(n)

%o digits = n.to_s.chars.map(&:to_i)

%o countDigits = digits.size

%o until digits.last >= n do

%o sum = digits.last(countDigits).sum

%o digits.push(sum)

%o end

%o return digits.sum # Terms of this OEIS sequence

%o end # _Diego V. G. Silva_, Mar 24 2023

%o (PARI) a(n)={my(v=digits(n), s=vecsum(v)); while(v[#v] < n, v=concat(v[2..#v], vecsum(v)); s+=v[#v]); s} \\ _Andrew Howroyd_, Mar 23 2023

%Y Cf. A007629.

%K nonn,base

%O 10,1

%A _Diego V. G. Silva_, Mar 23 2023