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

 

Logo

Please make a donation to keep the OEIS running. We are now in our 55th year. In the past year we added 12000 new sequences and reached 8000 citations (which often say "discovered thanks to the OEIS"). We need to raise money to hire someone to manage submissions, which would reduce the load on our editors and speed up editing.
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A111755 Excess of n over a greedy sum of distinct squares. 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; refs; listen; history; text; internal format)
OFFSET

1,3

COMMENTS

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). It is not hard to prove that a(n) always lies in 0..3 inclusive.

All nonzero terms are one greater than the previous term. - Iain Fox, Oct 17 2018

LINKS

Iain Fox, Table of n, a(n) for n = 1..10000

FORMULA

a(A003995(n)) = 0. - Iain Fox, Oct 17 2018

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] (* Robert G. Wilson v, Nov 22 2005 *)

PROG

(PARI) a(n) = my(s=sqrtint(n)); while(s > 0, if(n >= s^2, n -= s^2); s--); n \\ Iain Fox, Oct 17 2018

CROSSREFS

Cf. A003995.

Sequence in context: A097098 A123679 A167948 * A144528 A290694 A146164

Adjacent sequences:  A111752 A111753 A111754 * A111756 A111757 A111758

KEYWORD

easy,nonn

AUTHOR

John W. Layman, Nov 21 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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 6 08:53 EST 2019. Contains 329788 sequences. (Running on oeis4.)