OFFSET
1,3
COMMENTS
Comment from Michael Taktikos, Sep 04 2004: The following is a much simpler definition of this sequence: a[1] = 1; a[n_] := Mod[Sum[a[k], {k, 1, n - 1}], n - 1]
FORMULA
a(n+1) = sum{k=1 to n} (sum{j|k} a(j)) * p(n-k), where p(k) is the number of partitions of k (A000041).
EXAMPLE
We have the partitions of 4: 1+1+1+1, 1+1+2, 1+3, 2+2, 4; replace and add: 1+1+1+1 +1+1+1 +1+3 +1+1 +8 = 21 = a(5).
MATHEMATICA
a[1] = 1; a[n_] := a[n] = Block[{j, k, s = 0}, For[k = 1, k < n, k++, j = Divisors[k]; s = s + Plus @@ ((a /@ j)PartitionsP[n - k - 1])]; s]; Table[ a[n], {n, 30}] (* Robert G. Wilson v, Aug 25 2004 *) (* or slower *)
(* first *) Needs["DiscreteMath`Combinatorica`"] (* then *) a[1] = 1; a[n_] := a[n] = Block[{p = Sort[ Flatten[ Partitions[n - 1]] ]}, Plus @@ (a /@ p)]; Table[ a[n], {n, 30}] (* Robert G. Wilson v, Aug 25 2004 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Leroy Quet, Aug 17 2004
EXTENSIONS
More terms from Robert G. Wilson v, Aug 25 2004
STATUS
approved