This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A137442 #30 Nov 03 2014 03:28:22 %S A137442 1,2,4,3,9,5,16,6,25,7,36,8,49,10,64,11,81,12,100,13,121,14,144,15, %T A137442 169,17,196,18,225,19,256,20,289,21,324,22,361,23,400,24,441,26,484, %U A137442 27,529,28,576,29,625,30,676,31,729,32,784,33,841,34,900,35,961,37,1024,38 %N A137442 n^2 followed by smallest integer not yet listed. %C A137442 Sequence is a permutation of the positive integers. %H A137442 Harvey P. Dale, <a href="/A137442/b137442.txt">Table of n, a(n) for n = 1..1000</a> %F A137442 Formula, generating two terms for every m: m^2, m + round(sqrt(m)). %F A137442 IFTE(n mod 2 ==1, ((n+1)/2)^2, (n/2)+round(sqrt(n/2),0)). - _Gerald Hillier_, Nov 15 2010 %t A137442 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 *) %t A137442 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 *) %o A137442 (Ruby) %o A137442 # correct to any term: %o A137442 sk_ct = 2 %o A137442 skip = 4 %o A137442 at = 1 %o A137442 (1..(1.0/0)).each{ |i| %o A137442 if (at+=1) == skip %o A137442 at+=1 %o A137442 sk_ct +=1 %o A137442 skip = sk_ct * sk_ct %o A137442 end %o A137442 print i*i, " ", at, " " %o A137442 } %o A137442 (Ruby) %o A137442 # Simpler Ruby code, correct until i is so large that floating point rounding causes errors. I estimate this will be before i reaches 10000000000000000 %o A137442 (1..(1.0/0)).each{ |i| %o A137442 print i*i, " ", i + (Math.sqrt(i) + 0.5).to_i, " " %o A137442 } %o A137442 (PARI) lista(nn) = {for (n=1, nn, print1(n^2, ", ", n+round(sqrt(n)), ", "););} \\ _Michel Marcus_, Nov 02 2014 %o A137442 (PARI) a(n) = if (n % 2, ((n+1)/2)^2, (n/2)+round(sqrt(n/2))); \\ _Michel Marcus_, Nov 02 2014 %Y A137442 Cf. A000463. %K A137442 easy,nonn %O A137442 1,2 %A A137442 _Andy Martin_, Apr 18 2008 %E A137442 More terms from _Robert G. Wilson v_, May 31 2009