proposed
approved
proposed
approved
editing
proposed
approved
editing
reviewed
approved
proposed
reviewed
editing
proposed
nmax = 100; A5228 = {1};
Module[{d = 2, k = 1}, Do[While[MemberQ[A5228, d], d++]; k += d; d++; AppendTo[A5228, k], {n, 1, nmax}]];
a46[n_] := For[k = 1, True, k++, If[A5228[[k]] > n, Return[k - 1]]];
a47[n_] := If[n == 1, 1, a46[n] (a46[n] - a46[n - 1])];
a48[n_] := a48[n] = If[n == 1, 0, a48[n-1] + (1 - (a46[n] - a46[n-1]))];
a49[n_] := If[n == 1, 0, a48[n] (a48[n] - a48[n - 1])];
a[n_] := If[n < 3, n, 2 (a47[n] + a49[n]) - (a46[n] - a46[n - 1])];
Table[a[n], {n, 0, nmax}] (* Jean-François Alcover, Dec 09 2021 *)
approved
editing
proposed
approved
editing
proposed