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!)
A061336 Smallest number of triangular numbers which sum to n. 15
0, 1, 2, 1, 2, 3, 1, 2, 3, 2, 1, 2, 2, 2, 3, 1, 2, 3, 2, 3, 2, 1, 2, 3, 2, 2, 3, 2, 1, 2, 2, 2, 3, 3, 2, 3, 1, 2, 2, 2, 3, 3, 2, 2, 3, 1, 2, 3, 2, 2, 3, 2, 3, 3, 3, 1, 2, 2, 2, 3, 2, 2, 3, 3, 2, 2, 1, 2, 3, 2, 2, 3, 2, 2, 3, 3, 2, 3, 1, 2, 3, 2, 3, 2, 2, 3, 3, 2, 2, 3, 2, 1, 2, 2, 2, 3, 3, 2, 3, 2, 2, 2, 2, 3, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

a(n)=3 if n=5 or 8 mod 9, since triangular numbers are {0,1,3,6} mod 9.

LINKS

Giovanni Resta, Table of n, a(n) for n = 0..10000

FORMULA

a(n) = 0 if n=0, otherwise 1 if n is in A000217, otherwise 2 if n is in A051533, otherwise 3 in which case n is in A020757.

EXAMPLE

a(3)=1 since 3=3, a(4)=2 since 4=1+3, a(5)=3 since 5=1+1+3, with 1 and 3 being triangular.

MATHEMATICA

t[n_]:=n*(n+1)/2; a[0]=0; a[n_]:=Block[ {k=1, tt= t/@ Range[Sqrt[2*n]]}, Off[IntegerPartitions::take]; While[{} == IntegerPartitions[n, {k}, tt, 1], k++]; k]; a/@ Range[0, 104] (* Giovanni Resta, Jun 09 2015 *)

PROG

(PARI) see A283370 for generic code, working but not optimized for this case of triangular numbers. - M. F. Hasler, Mar 06 2017

(PARI) a(n)=my(m=n%9, f); if(m==5 || m==8, return(3)); f=factor(4*n+1); for(i=1, #f~, if(f[i, 2]%2 && f[i, 1]%4==3, return(3))); if(ispolygonal(n, 3), n>0, 2) \\ Charles R Greathouse IV, Mar 17 2022

CROSSREFS

Cf. A000217, A007294, A057945, A061337, A051533, A020757.

Cf. A104246 (analog for A000292), A283365 (analog for A000332), A283370 (analog for A000389).

Sequence in context: A128117 A023115 A194436 * A057945 A285730 A353655

Adjacent sequences:  A061333 A061334 A061335 * A061337 A061338 A061339

KEYWORD

nonn

AUTHOR

Henry Bottomley, Apr 25 2001

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 16 04:38 EDT 2022. Contains 353688 sequences. (Running on oeis4.)