

A103864


a(1) = 1; a(n) = smallest positive integer not occurring earlier in sequence if n is a prime. a(n) = a(n1)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

Ivan Neretin, Table of n, a(n) for n = 1..10000
Index entries for sequences that are permutations of the natural numbers


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

Inverse: A103866.
Cf. A103865, A103867 (variant and its inverse).
Sequence in context: A084980 A101369 A125147 * A268712 A152679 A232561
Adjacent sequences: A103861 A103862 A103863 * A103865 A103866 A103867


KEYWORD

nonn,look


AUTHOR

Leroy Quet, Feb 18 2005


EXTENSIONS

More terms from John W. Layman, May 27 2005
Corrected by Franklin T. AdamsWatters, Nov 22 2006


STATUS

approved



