|
|
A103864
|
|
a(1) = 1; a(n) = smallest positive integer not occurring earlier in sequence if n is a prime. a(n) = a(n-1)th smallest positive integer among those not occurring earlier in sequence if n is composite.
|
|
4
|
|
|
1, 2, 3, 6, 4, 9, 5, 12, 20, 29, 7, 16, 8, 19, 33, 48, 10, 24, 11, 27, 46, 67, 13, 32, 55, 80, 106, 133, 14, 36, 15, 39, 68, 99, 132, 167, 17, 43, 75, 111, 18, 47, 21, 53, 91, 135, 22, 57, 98, 146, 196, 247, 23, 60, 105, 157, 212, 269, 25, 64, 26, 69, 121, 180, 242, 307, 28
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Sequence is a permutation of the positive integers.
|
|
LINKS
|
|
|
EXAMPLE
|
Since 6 is composite, a(6) = a(5)th (4th) smallest positive integer not occurring earlier in sequence. The terms not occurring earlier in sequence are 5,7,8,9,10... and the 4th of these is 9.
|
|
MATHEMATICA
|
a = {1}; Do[AppendTo[a, Complement[Range[Max[a] + a[[-1]] + 1], a][[If[PrimeQ[n], 1, a[[-1]]]]]], {n, 2, 67}]; a (* Ivan Neretin, May 09 2015 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|