|
Search: id:A137442
|
|
|
| A137442 |
|
n^2 followed by smallest integer not yet listed. This is a permutation of the positive integers. |
|
+0 1
|
|
| 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
(list; graph; listen)
|
|
|
OFFSET
|
1,2
|
|
|
FORMULA
|
Formula, generating two terms for every n: n^2, n + round(sqrt(n))
|
|
PROGRAM
|
Ruby code, 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, " "
}
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, " "
}
|
|
CROSSREFS
|
Cf. A000463.
Sequence in context: A021045 A063379 A000463 this_sequence A111390 A129596 A060837
Adjacent sequences: A137439 A137440 A137441 this_sequence A137443 A137444 A137445
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
Andy Martin (oldadit(AT)gmail.com), Apr 18 2008
|
|
|
Search completed in 0.002 seconds
|