OFFSET
1,2
COMMENTS
A permutation of positive integers.
LINKS
FORMULA
Does a(n)=n+o(n)? Does a(n)=n for infinitely many values of n?
EXAMPLE
Runs of odd or even terms are : (1),(2,4),(3,5,7,9),(6,8,10),(11,13,15,17,19),...and computing the number of integers in each run we get : 1,2,4,3,5,...the sequence itself.
PROG
(GNU bc)
maxarray=2^16;
print oe[1]=a[1]=1, ", ", a[2]=2, ", ", oe[k=0]=a[p=n=3]=4, ", ";
for(max=100; p<maxarray&&n<max; p++) {
for(i=0*k=!k; i<a[p]&&n<max; i++) {
an=oe[k]+=2;
if (++n<maxarray) a[n]=an;
print an, ", "
};
}; /* Carl R. White, Jan 05 2013 */
(Haskell)
a093506 n = a093506_list !! (n-1)
a093506_list = 1 : 2 : f 1 [1] [3, 5..] [4, 6..]
where f 0 (z:zs) odds evens = orun ++ f 1 (zs ++ orun) odds' evens
where (orun, odds') = splitAt z odds
f 1 (z:zs) odds evens = erun ++ f 0 (zs ++ erun) odds evens'
where (erun, evens') = splitAt z evens
-- Reinhard Zumkeller, Jan 06 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, May 14 2004
EXTENSIONS
Sequence corrected by Carl R. White, Jan 06 2013
STATUS
approved