login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A101412 Least number of odd squares that sum to n. 2
1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9 (list; graph; refs; listen; history; internal format)
OFFSET

1,2

LINKS

Charles R Greathouse IV, Table of n, a(n) for n = 1..10000

EXAMPLE

a(13) = 5: 13 = 1+1+1+1+9.

MAPLE

A101412 := proc(n) local lsq; lsq := [seq((2*j+1)^2, j=0..floor((sqrt(n)-1)/2))] ; lsq := convert(lsq, set) ; a := n ; for p in combinat[partition](n) do if convert(p, set) minus lsq = {} then a := min(a, nops(p)) ; fi; od: a ; end: for n from 1 do printf("%d, \n", A101412(n)) ; od: [From R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Aug 08 2009]

## problem has optimal substructure ##

a:= proc(n) option remember; local r;

      r:= sqrt(n);

      `if` (type(r, integer) and is(r, odd), 1,

           min (seq (a(i)+a(n-i), i=1..floor(n/2))))

    end:

seq (a(n), n=1..105);

# Alois P. Heinz (heinz(AT)hs-heilbronn.de), Jan 31 2011

CROSSREFS

Cf. A002828, A151925.

Sequence in context: A190598 A053844 A010887 * A053830 A033929 A025482

Adjacent sequences:  A101409 A101410 A101411 * A101413 A101414 A101415

KEYWORD

nonn,easy

AUTHOR

N. J. A. Sloane (njas(AT)research.att.com), Aug 08 2009

EXTENSIONS

More terms from R. J. Mathar (mathar(AT)strw.leidenuniv.nl), Aug 08 2009

More terms from Alois P. Heinz (heinz(AT)hs-heilbronn.de), Jan 30 2011

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 14 15:25 EST 2012. Contains 205627 sequences.