OFFSET
1,2
COMMENTS
Generalization: let the first k terms of the sequence be 1,2,...,k, and for n > k, let b(n) be defined as the least positive integer that is not the sum of k or fewer previous terms; then b(n+k) = b(n) + n* k(k+1)/2. b(n) = (n+1)*k*(k+1)/2 + 1. n > k. Here a(n) is for k=3.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (2, -1).
FORMULA
a(n+4) = a(4) + 6n for n > 4; a(n) = 6n - 17, n >3.
From Chai Wah Wu, Oct 25 2018: (Start)
a(n) = 2*a(n-1) - a(n-2) for n > 5.
G.f.: x*(2*x^4 + 3*x^3 + 1)/(x - 1)^2. (End)
MATHEMATICA
a[1] = 1; a[2] = 2; a[3] = 3; a[n_] := a[n] = (m = 1; l = n - 1; t = Union[ Flatten[ Join[ Table[ a[i], {i, l}], Table[ a[i] + a[j], {i, l}, {j, i + 1, l}], Table[ a[i] + a[j] + a[k], {i, l}, {j, i + 1, l}, {k, j + 1, l}] ]]]; While[ Position[t, m] != {}, m++ ]; m); Table[ a[n], {n, 60}] (* Robert G. Wilson v, Dec 14 2004 *)
LinearRecurrence[{2, -1}, {1, 2, 3, 7, 13}, 60] (* Harvey P. Dale, Nov 17 2024 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Amarnath Murthy, Nov 25 2004
EXTENSIONS
More terms from Robert G. Wilson v, Dec 14 2004
STATUS
approved