%I #5 Mar 11 2022 08:02:48
%S 1,1,1,1,2,3,2,2,3,2,2,3,2,2,3,2,2,4,3,2,4,3,2,4,3,2,5,1,2,2,2,2,3,2,
%T 2,4,3,2,4,3,2,4,3,2,5,4,3,5,4,2,5,5,5,5,4,3,6,3,2,4,4,4,4,3,2,5,4,3,
%U 5,5,5,6,3,2,7,3,2,4,5,6,5,4,3,4,3,2,4,3,2,4,1,2,2,2,2,3,2,2,4,3,2,4,3,2,4
%N A Per Bak sand pile collapse sequence using A147665 in the A153112 form.
%D Per Bak, "How nature works, the science of self-organized criticality", Springer-Verlag, New York, 1996, pages 49-64
%t f[0] = 1; f[1] = 1; f[2] = 1;
%t f[n_] := f[n] = If[Mod[Floor[Sum[f[i], {i, 0, n - 1}]/2], 2^(4 + Mod[n, 3])] == 1, 1 + Mod[n, 3], f[f[n - 1]] + If[Mod[n, 3] == 0, f[f[n/3]], If[Mod[n, 3] == 1, f[f[(n - 1)/3]], f[n - f[(n - 2)/3]]]];
%t Table[f[n], {n, 0, 200}]
%Y Cf. A153112, A147665
%K nonn,uned
%O 0,5
%A _Roger L. Bagula_, Oct 15 2009