login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A102855 Minimal number of distinct nonzero tetrahedral numbers needed to represent n, or -1 if no such representation is possible. 6
1, -1, -1, 1, 2, -1, -1, -1, -1, 1, 2, -1, -1, 2, 3, -1, -1, -1, -1, 1, 2, -1, -1, 2, 3, -1, -1, -1, -1, 2, 3, -1, -1, 3, 1, 2, -1, -1, 2, 3, -1, -1, -1, -1, 2, 3, -1, -1, 3, 4, -1, -1, -1, -1, 2, 1, 2, -1, 3, 2, 3, -1, -1, -1, 3, 2, 3, -1, 4, 3, 4, -1, -1, -1, -1, 2, 3, -1, -1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,5
LINKS
MAPLE
N:= 100; # for a(1)..a(N)
ft:= t -> t*(t+1)*(t+2)/6:
tets:= map(ft, [$1..floor((6*N)^(1/3))]:
f:= proc(n, tmax) option remember;
local res, s;
if member(n, tets) and n < tmax then return 1 fi;
min(seq(1 + procname(n-s, s), s=select(`<`, tets, min(n, tmax))));
end proc:
subs(infinity=-1, map(f, [$1..N], infinity)); # Robert Israel, Dec 29 2019
MATHEMATICA
M = 100; (* number of terms *)
ft[t_] := t(t+1)(t+2)/6;
tets = ft /@ Range[1, Floor[(6M)^(1/3)]];
f[n_, tmax_] := f[n, tmax] = If[MemberQ[tets, n] && n < tmax, 1, Min[ Table[1 + f[n-s, s], {s, Select[tets, # < Min[n, tmax]&]}]]];
f[#, Infinity]& /@ Range[1, M] /. Infinity -> -1 (* Jean-François Alcover, Aug 05 2022, after Robert Israel *)
CROSSREFS
Sequence in context: A214566 A213982 A275811 * A124148 A174435 A330749
KEYWORD
sign
AUTHOR
Jud McCranie, Mar 01 2005
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 5 06:40 EDT 2024. Contains 372257 sequences. (Running on oeis4.)