OFFSET
1,4
COMMENTS
a(n) equals the difference between n and the largest number less than n that can be expressed as the sum of the i-th triangular number and the j-th tetrahedral number for integers i < j.
EXAMPLE
Triangle begins:
1;
1, 1, 2;
1, 1, 2, 1, 2, 3;
1, 1, 2, 1, 2, 3, 1, 2, 3, 4;
1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5;
1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6;
1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7;
...
MAPLE
T:= n-> seq([$1..i][], i=1..n):
seq(T(n), n=1..7); # Alois P. Heinz, Apr 10 2020
PROG
(Python)
from math import comb, isqrt
from sympy import integer_nthroot
def A333516(n): return (r:=n-1-comb((m:=integer_nthroot(6*n, 3)[0])+(n>comb(m+2, 3))+1, 3))-comb((k:=isqrt(m:=r+1<<1))+(m>k*(k+1)), 2)+1 # Chai Wah Wu, Nov 10 2024
CROSSREFS
KEYWORD
nonn,easy,tabf
AUTHOR
Andrew Slattery, Mar 25 2020
STATUS
approved