OFFSET
1,2
COMMENTS
A permutation of the positive integers.
LINKS
FORMULA
a(n)<a(n+2). - Robert G. Wilson v, Feb 11 2005
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)
-- Reinhard Zumkeller, Jul 01 2013
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
Leroy Quet, Jan 13 2005
EXTENSIONS
More terms from Robert G. Wilson v, Feb 11 2005
STATUS
approved