OFFSET
1,3
LINKS
Peter Kagey, Table of n, a(n) for n = 1..10000
EXAMPLE
We define a(1) = 1.
a(2) = 1, because 2 == a(1) (mod 1);
a(3) = 3, because 3 == a(1) (mod 1), and 3 == a(2) (mod 2): 1 + 2 = 3;
a(4) = 1, because 4 == a(1) (mod 1);
a(5) = 7, because 5 == 1 (mod 1), 5 == a(2) (mod 2), and 5 == a(4) (mod 4): 1 + 2 + 4 = 7.
MATHEMATICA
a = {1}; Do[AppendTo[a, Total@ Select[Range[n - 1], Mod[n, #] == Mod[a[[#]], #] &]], {n, 2, 64}]; a (* Michael De Vlieger, Mar 24 2016 *)
PROG
(Java)
int[] terms = new int[100];
terms[0] = 1;
for (int i = 1; i < 100; i++) {
int count = 0;
for (int j = 0; j < i; j++) {
if (((i+1) - terms[j]) % (j+1) == 0) {
count = count + j + 1;
}
}
terms[i] = count;
}
(PARI) lista(nn) = {va = vector(nn); print1(va[1] = 1, ", "); for (n=2, nn, va[n] = sum(m=1, n-1, m*(Mod(va[m], m) == Mod(n, m))); print1(va[n], ", "); ); } \\ Michel Marcus, Feb 26 2016
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Alec Jones, Feb 25 2016
STATUS
approved