login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A103865 a(1) = 1; a(n) = smallest positive integer not occurring earlier in sequence if n is a composite. a(n) = a(n-1)th smallest positive integer among those not occurring earlier in sequence if n is prime. 4
1, 2, 4, 3, 7, 5, 11, 6, 8, 9, 19, 10, 22, 12, 13, 14, 30, 15, 33, 16, 17, 18, 40, 20, 21, 23, 24, 25, 53, 26, 56, 27, 28, 29, 31, 32, 68, 34, 35, 36, 76, 37, 79, 38, 39, 41, 87, 42, 43, 44, 45, 46, 98, 47, 48, 49, 50, 51, 109, 52, 112, 54, 55, 57, 58, 59, 125, 60, 61, 62, 132 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Sequence is a permutation of the positive integers.

LINKS

Michael De Vlieger, Table of n, a(n) for n = 1..10000

EXAMPLE

Since 5 is prime, a(5) = a(4)th (3rd) smallest positive integer not occurring earlier in sequence. The terms not occurring earlier in sequence are 5,6,7,8,9... and the 3rd of these is 7.

MATHEMATICA

Block[{a = {1}, nn = 71, s}, s = Range[2, 2 nn + 1]; Do[{AppendTo[a, First@ #1], Set[s, #2]} & @@ TakeDrop[s, If[CompositeQ@ i, 1, {a[[i - 1]]}]], {i, 2, nn}]; a] (* Michael De Vlieger, Sep 25 2017 *)

CROSSREFS

Cf. A103864, A103866, A103867.

Sequence in context: A257465 A120234 A249571 * A065579 A304741 A280741

Adjacent sequences:  A103862 A103863 A103864 * A103866 A103867 A103868

KEYWORD

nonn

AUTHOR

Leroy Quet, Feb 18 2005

EXTENSIONS

More terms from Franklin T. Adams-Watters, Nov 22 2006

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 23 02:42 EDT 2019. Contains 321422 sequences. (Running on oeis4.)