OFFSET
1,3
COMMENTS
Each partition can have at most three parts if n is a multiple of three and at most two parts otherwise. - Andrew Howroyd, Jan 28 2020
In general, these sequences can be generated by a linear recurrence with a signature that contains k=1..d tuples of the form (d-1 zeros, (-1)^(k-1) * binomial(d, k)), where d = number of distinct parts (here: d=3). - Georg Fischer, Sep 03 2022
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (0,0,3,0,0,-3,0,0,1).
FORMULA
a(3*n) = 1 + n + binomial(n, 2); a(3*n-1) = a(3*n-2) = n. - Andrew Howroyd, Jan 28 2020
EXAMPLE
a(5)=2 because there are 2 such partition of 5: {5}, {2,3}.
MATHEMATICA
<< DiscreteMath`Combinatorica`; np[n_]:= Length@Select[Mod[ #, 3]& /@ Partitions[n], (Length@# != Length@Union@#)&]; lst = Array[np, 50] (* or *)
LinearRecurrence[{0, 0, 3, 0, 0, -3, 0, 0, 1}, {1, 1, 2, 2, 2, 4, 3, 3, 7}, 64] (* Georg Fischer, Sep 03 2022 *)
PROG
(PARI) a(n)={1 + n\3 + if(n%3==0, binomial(n/3, 2))} \\ Andrew Howroyd, Jan 28 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Giovanni Resta, Feb 06 2006
EXTENSIONS
Terms a(51) and beyond from Andrew Howroyd, Jan 28 2020
STATUS
approved