# [seqfan] Re: RE : Re: Correct seq defined by: a(a(n)) is a square

Benoît Jubin benoit.jubin at gmail.com
Sun Nov 22 23:28:56 CET 2009

```Of independent interest: in the definition below, I used the phrase
"The lexicographically smallest injective sequence of nonnegative
integers such that ...".  Browsing the OEIS, I have the feeling that
this type of phrase is implied in many sequences, but I think
explicitly writing it makes for a clearer definition.  Unless you
think it's too cumbersome... (the "lexicographically" might be removed
if this is implied to be the natural order on sequences).

Eric, since you originated the sequence, you should have the last word
(and be the "corresponding submitter" emailwise).  I suggest something
along those lines:
%I A000001
%S A000001 0,1,3,4,9,6,16,8,25,36,11,49,13,64,15,81,100,18,121,20,144,22,169,24,
%T A000001 196,225,27,256,29,289,31,324,33,361,35,400,441,38,484,40,529,42,576,44,
%U A000001 625,46,676,48,729,784,51
%N A000001 The lexicographically smallest injective sequence of
nonnegative integers such that a(a(n)) is a square for all n>=0.
%C A000001 The term a(n) is either n+1 or a square. All the squares
appear and they appear in increasing order. Every other term is a
square, except when the index is a square, in which case, the
corresponding term is also a square (which shifts the pattern). See
FORMULA for a more precise statement.
%F A000001 To define a(n), let k = floor(sqrt(n)). Then a(n) = n+1 if
n-k^2 is odd and ((n+k)/2)^2 if n-k^2 is even.
%F A000001 Note that k^2 is the largest square which is at most n.
%e A000001 For n=6, we have k=floor(sqrt(6))=2; since 6-2=4 is even,
a(6)=((6+2)/2)^2=16.
%K A000001 nonn
%O A000001 0,3
%A A000001 Benoit Jubin and Eric Angelini (YOUR EMAIL HERE), Nov 22 2009

--
Benoit

On Sun, Nov 22, 2009 at 9:30 PM, Eric Angelini <Eric.Angelini at kntv.be> wrote:
>
> Hello Benoit,
> would you mind submitting this seq
> to the OEIS together with yr comment?
> Best,
> E.
>
> -------- Message d'origine--------
> De: seqfan-bounces at list.seqfan.eu de la part de Benoît Jubin
> Date: dim. 22/11/2009 17:37
> À: Sequence Fanatics Discussion list
> Objet : [seqfan] Re: Correct seq defined by: a(a(n)) is a square
>
> This sequence is characterized by:
> * a(n) is either n+1 or a square
> * all the squares appear and they appear in increasing order
> * every other term is a square, except when the index is a square, in
> which case, the term is also a square.
>
> Alternatively, we can say that a(n)=n+1 exactly when n=3 or (n minus
> the largest square at most n) = n - (floor(sqrt(n)))^2 is odd, else it
> is the least square not already in the sequence.
>
> This sequence can begin at 0 since no special treatment is needed.
>
> Benoit
>
>
> On Sun, Nov 22, 2009 at 4:56 PM, Eric Angelini <Eric.Angelini at kntv.be> wrote:
>>
>> Hello SeqFans (quater)
>> Here is the correct seq obeing to: "a(a(n)) is a square":
>> S = 1,3,4,9,6,16,8,25,36,11,49,13,64,15,81,100,18,121,20,144,22,169,24,196,225,27,256,29,289,31,324,33,361,...
>> Again, "always use the smallest available
>> I guess that more of half the terms are
>> squares, and that this seq is "densier"
>> (in term of squares) than this one (see
>> former post): a(a(n))=a(n) squared
>>
>> ...
>>
>> Best,
>> E.
>>
>> __________________________________________
>>
>>
>>
>>
>> _______________________________________________
>>
>> Seqfan Mailing list - http://list.seqfan.eu/
>>
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>
>
>
> _______________________________________________
>
> Seqfan Mailing list - http://list.seqfan.eu/
>
>

```