Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A111755
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A111755 Excess of n over a greedy sum of distinct squares. +0
1
0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 2, 0, 0, 1, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 2, 0, 0, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 2, 0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 0, 0 (list; graph; listen)
OFFSET

1,3

COMMENT

Start with the value n and subtract the largest square (not previously used) less than or equal to n to get a new value. Repeat until the value 0 is reached or the square 1 has been subtracted. The resulting value is a(n). Is is not hard to prove that a(n) always lies in 0..3 inclusive.

EXAMPLE

a(24)=3, since 24 -> 24-16=8 -> 8-4=4 -> 4-1=3.

MATHEMATICA

f[n_] := Block[{s = n, k = Floor@Sqrt@n}, While[k > 0, If[s >= k^2, s -= k^2]; k-- ]; s]; Array[f, 105] (from Robert G. Wilson v (rgwv(at)rgwv.com), Nov 22 2005)

CROSSREFS

Adjacent sequences: A111752 A111753 A111754 this_sequence A111756 A111757 A111758

Sequence in context: A089731 A097098 A123679 this_sequence A051510 A122950 A116489

KEYWORD

nonn

AUTHOR

John W. Layman (layman(AT)math.vt.edu), Nov 21 2005

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified October 9 14:06 EDT 2008. Contains 144831 sequences.


AT&T Labs Research