OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
Ben Paul Thurston, Low Kolmorogov complexity but never repeating series?
EXAMPLE
For n = 7, a(6) is 16, where the sum of the digits is 7, of which the remainder when divided by 5 is 2, then plus 1 is 3. Thus a(7) is a(6) + 3 or 19.
MAPLE
a:= proc(n) a(n):= `if`(n=1, 1, a(n-1) +1 +irem(
add(i, i=convert(a(n-1), base, 10)), 5)) end:
seq(a(n), n=1..100); # Alois P. Heinz, Feb 15 2014
MATHEMATICA
NestList[#+Mod[Total[IntegerDigits[#]], 5]+1&, 1, 50] (* Harvey P. Dale, Nov 23 2023 *)
PROG
(Python)
def adddigits(i):
s = str(i)
t=0
for j in s:
t = t+int(j)
return t
n = 1
a = [1]
for i in range(0, 100):
r = adddigits(n)%5+1
n = n+r
a.append(n)
print(a)
(PARI) digsum(n)=d=eval(Vec(Str(n))); sum(i=1, #d, d[i])
a=vector(1000); a[1]=1; for(n=2, #a, a[n]=a[n-1]+digsum(a[n-1])%5+1); a \\ Colin Barker, Feb 14 2014
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ben Paul Thurston, Jan 16 2014
STATUS
approved