login
A361759
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
34, 33, 32, 44, 33, 40, 47, 54, 61, 39, 68, 75, 66, 86, 64, 76, 88, 100, 66, 73, 102, 96, 129, 99, 119, 139, 96, 108, 120, 132, 136, 117, 150, 112, 132, 152, 172, 116, 128, 140, 170, 138, 171, 204, 145, 165, 185, 205, 225, 148, 204, 159, 192, 225, 258, 178
OFFSET
10,1
COMMENTS
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.
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.
EXAMPLE
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.
PROG
(Ruby)
def a(n)
digits = n.to_s.chars.map(&:to_i)
countDigits = digits.size
until digits.last >= n do
sum = digits.last(countDigits).sum
digits.push(sum)
end
return digits.sum # Terms of this OEIS sequence
end # Diego V. G. Silva, Mar 24 2023
(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
CROSSREFS
Cf. A007629.
Sequence in context: A302209 A022990 A023476 * A104685 A204773 A291512
KEYWORD
nonn,base
AUTHOR
Diego V. G. Silva, Mar 23 2023
STATUS
approved