cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A235915 a(1) = 1, a(n) = a(n-1) + (digsum(a(n-1)) mod 5) + 1, digsum = A007953.

Original entry on oeis.org

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

Views

Author

Ben Paul Thurston, Jan 16 2014

Keywords

Examples

			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.
		

Crossrefs

Cf. A007953.

Programs

  • 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 *)
  • 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
  • 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)