|
|
A127521
|
|
a(1)=1. n-th run, after the initial 1, of a(n) integers is the (1st, 2nd, 3rd,.., a(n)th) integer from among those positive integers which don't occur earlier in the sequence (including earlier in the same run).
|
|
1
|
|
|
1, 2, 3, 5, 4, 7, 9, 6, 10, 12, 14, 16, 8, 13, 17, 19, 11, 18, 21, 23, 25, 27, 29, 15, 22, 26, 30, 32, 34, 36, 38, 40, 20, 28, 33, 37, 41, 43, 24, 35, 42, 45, 47, 49, 51, 53, 55, 57, 31, 44, 48, 52, 56, 59, 61, 63, 65, 67, 69, 71, 39, 50, 58, 62, 66, 70, 73, 75, 77, 79, 81, 83
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
This sequence is a permutation of the positive integers.
|
|
LINKS
|
|
|
EXAMPLE
|
The beginning of the sequence grouped by runs:
1,(2),(3,5),(4,7,9),(6,10,12,14,16),(8,13,17,19),(11,18,21,23,25,27,29),..
The n-th run, after the initial 1, has a(n) terms.
The 5th run has a(5)=4 terms. The positive integers which don't occur before this run are 8,11,13,15,17,18,19,20,... The first term of the 5th run is the first term of these integers, which is 8.
Since 8 has just occurred in the sequence, the 2nd term in the fifth run is not 11, but is instead 13. Now the positive integers that have yet to occur are 11,15,17,18,19,...For the 3rd term of the 5th run we want the 3rd of these, which is 17. And finally we want the 4th positive integer which has yet to occur in the sequence, which is 19.
|
|
MATHEMATICA
|
f[l_List] := Block[{r = {}, s, c, k, m}, m = Flatten[l][[Length[l]]]; Do[ s = Flatten[Append[l, r]]; c = i; k = 0; While[c > 0, k++; While[MemberQ[s, k], k++ ]; c--; ]; AppendTo[r, k]; , {i, m}]; Append[l, r]]; Flatten@Nest[f, {{1}}, 11] (* Ray Chandler, Jan 22 2007 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|