login
A235915
a(1) = 1, a(n) = a(n-1) + (digsum(a(n-1)) mod 5) + 1, digsum = A007953.
1
1, 3, 7, 10, 12, 16, 19, 20, 23, 24, 26, 30, 34, 37, 38, 40, 45, 50, 51, 53, 57, 60, 62, 66, 69, 70, 73, 74, 76, 80, 84, 87, 88, 90, 95, 100, 102, 106, 109, 110, 113, 114, 116, 120, 124, 127, 128, 130, 135, 140, 141
OFFSET
1,2
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
Cf. A007953.
Sequence in context: A147683 A319279 A013574 * A310178 A310179 A310180
KEYWORD
nonn,base
AUTHOR
Ben Paul Thurston, Jan 16 2014
STATUS
approved