[go: up one dir, main page]

login
A167051
Start at 1, then add the first term (which is one here) plus 1 for the second term; then add the second term plus 2 for the third term; then add the third term to the sum of the first and second term; this gives the fourth term. Restart the sequence by adding 1 to the fourth term, etc. (From a sixth grade math extra credit assignment)
1
1, 2, 4, 7, 8, 10, 25, 26, 28, 79, 80, 82, 241, 242, 244, 727, 728, 730, 2185, 2186, 2188, 6559, 6560, 6562, 19681, 19682, 19684, 59047, 59048, 59050, 177145, 177146, 177148, 531439, 531440, 531442, 1594321, 1594322, 1594324, 4782967, 4782968, 4782970, 14348905
OFFSET
1,2
LINKS
FORMULA
a(n) = a(n-1) + 1 for n mod 3 == 2;
a(n) = a(n-1) + 2 for n mod 3 == 0;
a(n) = a(n-1) + a(n-2) + a(n-3) for n mod 3 == 1 and n > 1.
G.f.: x*(1 + 2*x + 4*x^2 + 3*x^3 - 6*x^5)/((1 - x)*(1 + x + x^2)*(1 - 3*x^3)). - Andrew Howroyd, Apr 13 2021
PROG
(PARI) seq(n)={my(a=vector(n)); a[1]=1; for(n=2, #a, my(t=n%3); a[n]=a[n-1]+if(t==2, 1, if(t==0, 2, a[n-2]+a[n-3]))); a} \\ Andrew Howroyd, Apr 13 2021
(PARI) Vec((1 + 2*x + 4*x^2 + 3*x^3 - 6*x^5)/((1 - x)*(1 + x + x^2)*(1 - 3*x^3)) + O(x^40)) \\ Andrew Howroyd, Apr 13 2021
CROSSREFS
Sequence in context: A182218 A093701 A045601 * A151661 A094599 A050082
KEYWORD
nonn
AUTHOR
Chris Rice (cwrice(AT)research.att.com), Oct 27 2009
STATUS
approved