|
|
A101369
|
|
a(2n-1) = the smallest positive integer not occurring earlier in the sequence. a(2n) = the a(2n-1)th smallest positive integer among those not occurring earlier in the sequence.
|
|
3
|
|
|
1, 2, 3, 6, 4, 9, 5, 12, 7, 16, 8, 19, 10, 23, 11, 26, 13, 30, 14, 33, 15, 36, 17, 40, 18, 43, 20, 47, 21, 50, 22, 53, 24, 57, 25, 60, 27, 64, 28, 67, 29, 70, 31, 74, 32, 77, 34, 81, 35, 84, 37, 88, 38, 91, 39, 94, 41, 98, 42, 101, 44, 105, 45, 108, 46, 111, 48, 115, 49, 118
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
A permutation of the positive integers.
|
|
LINKS
|
|
|
FORMULA
|
For n>0, a(2n-1)=1+floor((2n-1)/sqrt(2)) and a(2n)=2n+floor((2n)/sqrt(2)-1/sqrt(2)) - Benoit Cloitre, Feb 22 2005
|
|
MATHEMATICA
|
lst = Range[150]; a[n_] := a[n] = If[ OddQ[n], b = First[lst]; lst = Rest[lst]; b, b = lst[[ a[n - 1]]]; lst = Drop[lst, {a[n - 1]}]; b]; Table[ a[n], {n, 70}]
|
|
PROG
|
(Haskell)
import Data.List (delete)
a101369 n = a101369_list !! (n-1)
a101369_list = f [1..] where
f (x:xs) = x : y : f (delete y xs) where y = xs !! (x - 1)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,nice
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|