login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Thanks to everyone who made a donation during our annual appeal!
To see the list of donors, or make a donation, see the OEIS Foundation home page.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A026166 For n >= 2, let h=floor((n-1)/2), L=n-h, R=n+h; then a(L)=n if a(L) not yet defined, otherwise a(R)=n; thus |a(n)-n| = floor((1/2)*(a(n)-1)). 12
1, 2, 4, 3, 8, 10, 5, 6, 16, 7, 20, 22, 9, 26, 28, 11, 12, 34, 13, 14, 40, 15, 44, 46, 17, 18, 52, 19, 56, 58, 21, 62, 64, 23, 24, 70, 25, 74, 76, 27, 80, 82, 29, 30, 88, 31, 32, 94, 33, 98, 100, 35, 36, 106, 37, 38, 112, 39, 116, 118, 41, 42 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Every positive integer occurs exactly once. The inverse permutation of the positive integers is given by A026167. - Clark Kimberling, Oct 20 2019

LINKS

Clark Kimberling, Table of n, a(n) for n = 1..10000 (terms 1..1502 from R. J. Mathar)

F. M. Dekking, Permutations of N generated by left-right filling algorithms, arXiv:2001.08915 [math.CO], 2020.

FORMULA

|a(n)-n| = floor((1/2)*(a(n)-1)).

This formula does not permit us to calculate the n-th term of the sequence, since the equation |x-n| = floor((1/2)*(x-1)) has at least 2 integer solutions for all n. - Michel Dekking, Nov 26 2019

MATHEMATICA

a[1] = 1; z = 300;

Do[{L, R} = {n - #, n + #} &[Floor[(n - 1)/2]];

  If[! Head[a[L]] === Integer, a[L] = n, a[R] = n], {n, 2, z}];

a026166 = Most[Last[

   Last[Reap[NestWhile[# + 1 &, 1, Head[Sow[a[#]]] === Integer &]]]]];

ListPlot[a026166]  (* Peter J. C. Moses, Oct 20 2019 *)

PROG

(Python)

A026166 = {1: 1}

for n in range(2, 1000):

    h=(n-1)//2

    L=n-h

    R=n+h

    if not L in A026166 :

        A026166[L]=n

    else :

        A026166[R]=n

for n in range(1, 2000):

    if n in A026166:

       print(A026166[n], end=', ')

    else:

        break

# R. J. Mathar, Aug 26 2019

(PARI) seq(n)={my(a=vector(n)); a[1]=1; for(i=1, 2*n-1, my(h=(i-1)\2); if(!a[i-h], a[i-h]=i, if(i+h<=n, a[i+h]=i))); a} \\ Andrew Howroyd, Oct 15 2019

CROSSREFS

Cf. A026167, A026182, A026198, A026202.

Sequence in context: A279356 A241909 A245451 * A186003 A077624 A077632

Adjacent sequences:  A026163 A026164 A026165 * A026167 A026168 A026169

KEYWORD

nonn

AUTHOR

Clark Kimberling

EXTENSIONS

Edited by N. J. A. Sloane, Jan 31 2020

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 January 16 09:13 EST 2021. Contains 340204 sequences. (Running on oeis4.)