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

 

Logo

Annual Appeal: Please make a donation (tax deductible in USA) to keep the OEIS running. Over 5000 articles have referenced us, often saying "we discovered this result with the help of the OEIS".

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A054791 Earliest sequence with a(a(n))=n^2. 2
0, 1, 3, 4, 9, 6, 25, 8, 49, 16, 11, 100, 13, 144, 15, 196, 81, 18, 289, 20, 361, 22, 441, 24, 529, 36, 27, 676, 29, 784, 31, 900, 33, 1024, 35, 1156, 625, 38, 1369, 40, 1521, 42, 1681, 44, 1849, 46, 2025, 48, 2209, 64, 51, 2500, 53, 2704, 55, 2916, 57, 3136, 59 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

LINKS

T. D. Noe, Table of n, a(n) for n = 0..1000

Index entries for sequences of the a(a(n)) = 2n family

FORMULA

if n is a square then a(n)=a(sqrt(n))^2, otherwise if the difference between n and the highest square less than n is odd then a(n)=n+1, otherwise a(n)=(n-1)^2

MATHEMATICA

a[n_] := a[n] = Which[r = Sqrt[n]; IntegerQ[r], a[r]^2, OddQ[n - Floor[r]^2], n+1, True, (n-1)^2]; a[0]=0; a[1]=1; Table[a[n], {n, 0, 58}] (* Jean-Fran├žois Alcover, Aug 07 2012, after formula *)

PROG

(Haskell)

a054791 n = a054791_list `genericIndex` n

a054791_list = 0 : 1 : f 2 where

   f x | r ^ 2 == x  = a054791 r ^ 2 : f (x + 1)

       | odd (x - r) = x + 1         : f (x + 1)

       | otherwise   = (x - 1) ^ 2   : f (x + 1)

       where r = a000196 x

-- Reinhard Zumkeller, Oct 27 2013

CROSSREFS

Cf. A002516.

Sequence in context: A180253 A264786 A055225 * A167531 A062319 A178590

Adjacent sequences:  A054788 A054789 A054790 * A054792 A054793 A054794

KEYWORD

nice,nonn

AUTHOR

Henry Bottomley, Apr 27 2000

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 | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified December 10 04:09 EST 2016. Contains 278993 sequences.