The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A137442 n^2 followed by smallest integer not yet listed. 2
 1, 2, 4, 3, 9, 5, 16, 6, 25, 7, 36, 8, 49, 10, 64, 11, 81, 12, 100, 13, 121, 14, 144, 15, 169, 17, 196, 18, 225, 19, 256, 20, 289, 21, 324, 22, 361, 23, 400, 24, 441, 26, 484, 27, 529, 28, 576, 29, 625, 30, 676, 31, 729, 32, 784, 33, 841, 34, 900, 35, 961, 37, 1024, 38 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 COMMENTS Sequence is a permutation of the positive integers. LINKS Harvey P. Dale, Table of n, a(n) for n = 1..1000 FORMULA Formula, generating two terms for every m: m^2, m + round(sqrt(m)). IFTE(n mod 2 ==1, ((n+1)/2)^2, (n/2)+round(sqrt(n/2),0)). - Gerald Hillier, Nov 15 2010 MATHEMATICA f[s_List] := Block[{k = 1}, While[ MemberQ[s, k], k++ ]; Flatten@ Append[s, {((2 + Length@s)/2)^2, k}]]; Nest[f, {1, 2}, 33] (* Robert G. Wilson v, May 31 2009 *) Module[{nn=40, sq, int, len}, sq=Range[nn]^2; int=Complement[Range[nn], sq]; len=Min[Length[int], nn]; Riffle[Take[sq, len], Take[int, len]]](* Harvey P. Dale, Nov 05 2013 *) PROG (Ruby) # correct to any term: sk_ct = 2 skip = 4 at = 1 (1..(1.0/0)).each{ |i| if (at+=1) == skip at+=1 sk_ct +=1 skip = sk_ct * sk_ct end print i*i, " ", at, " " } (Ruby) # Simpler Ruby code, correct until i is so large that floating point rounding causes errors. I estimate this will be before i reaches 10000000000000000 (1..(1.0/0)).each{ |i| print i*i, " ", i + (Math.sqrt(i) + 0.5).to_i, " " } (PARI) lista(nn) = {for (n=1, nn, print1(n^2, ", ", n+round(sqrt(n)), ", "); ); } \\ Michel Marcus, Nov 02 2014 (PARI) a(n) = if (n % 2, ((n+1)/2)^2, (n/2)+round(sqrt(n/2))); \\ Michel Marcus, Nov 02 2014 CROSSREFS Cf. A000463. Sequence in context: A293779 A063379 A000463 * A111390 A129596 A329901 Adjacent sequences:  A137439 A137440 A137441 * A137443 A137444 A137445 KEYWORD easy,nonn AUTHOR Andy Martin, Apr 18 2008 EXTENSIONS More terms from Robert G. Wilson v, May 31 2009 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.

Last modified April 15 09:32 EDT 2021. Contains 342977 sequences. (Running on oeis4.)