cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A252458 Fixed points of permutations A249990 and A252448.

Original entry on oeis.org

8, 13, 14, 34, 139, 140, 383, 960, 1609, 2064, 5487, 7171, 7715, 21059, 22523, 24148, 91924, 117728, 200193, 304381, 609147, 866933, 920405, 930571, 985939
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 17 2014

Keywords

Comments

A249990(a(n)) = A252448(a(n)) = a(n).

Crossrefs

Programs

  • Haskell
    a252458 n = a252458_list !! (n-1)
    a252458_list = [x | x <- [1..], a249990 x == x]

A249990 Start with the natural numbers, reverse the order in each pair, skip one pair, reverse the order in each triple, skip one triple, and so on.

Original entry on oeis.org

2, 1, 6, 3, 4, 12, 5, 8, 7, 16, 9, 10, 13, 14, 22, 15, 18, 11, 24, 17, 32, 25, 26, 19, 20, 23, 30, 48, 31, 38, 21, 28, 27, 34, 33, 52, 35, 42, 29, 36, 39, 40, 49, 50, 58, 51, 54, 41, 44, 37, 60, 43, 66, 53, 84, 67, 68, 61, 62, 45, 46, 55, 56, 59, 76, 94, 77, 90
Offset: 1

Views

Author

Alex Ratushnyak, Nov 27 2014

Keywords

Comments

A permutation of natural numbers generated by the following algorithm.
Start with the natural numbers. Reverse the order of numbers in each pair. Skip one pair. In the remainder (that is, "4, 3, 6, 5, 8, 7, 10, 9, 12, 11,...") reverse the order in each triple. Skip one triple. In the remainder (it starts with "7, 8, 5, 12, 9, 10") reverse the order in each tetrad. Skip one tetrad. And so on.

Examples

			Start with:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ...
After the first step:
2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, ...
After the 2nd step:
2, 1, 6, 3, 4, 7, 8, 5, 12, 9, 10, 13, 14, 11, 18, 15, 16, ...
After the 3rd step:
2, 1, 6, 3, 4, 12, 5, 8, 7, 14, 13, 10, 9, 16, 15, 18, 11, ...
		

Crossrefs

Cf. A252448 (inverse), A252458 (fixed points).

Programs

  • Haskell
    a249990 n = a249990_list !! (n-1)
    a249990_list = f 2 [1..] where
       f k xs = reverse ys ++ f (k + 1) (g zs) where
                g us = reverse vs ++ g ws where
                       (vs, ws) = splitAt k us
                (ys, zs) = splitAt k xs
    -- Reinhard Zumkeller, Dec 17 2014
  • Python
    TOP = 100
    a = list(range(TOP))
    for step in range(2,TOP):
        numBlocks = (len(a)-1) // step
        if numBlocks==0:  break
        a = a[:(1+numBlocks*step)]
        for pos in range(1,len(a),step):
            a[pos:pos+step] = a[pos+step-1:pos-1:-1]
        for i in range(1, step+1):  print(str(a[i]), end=',')
        a[1:] = a[step+1:]
    

A135317 Let h(2*n, 1) = 2*n and h(2*n, m) = h(2*n, m-1) + 2 * d(2*n, m) for m > 1, where d(2*n, m) = (least multiple of m not less than h(2*n, m-1)) - h(2*n, m-1). Then d(2*n, m) is eventually 2-periodic as a function of m, and a(n) is defined as d(2*n, 2*m+1) for large m.

Original entry on oeis.org

0, 1, 2, 0, 1, 2, 3, 4, 0, 3, 4, 5, 1, 2, 3, 6, 0, 1, 4, 5, 6, 2, 5, 6, 7, 8, 0, 7, 8, 9, 3, 4, 5, 1, 2, 3, 6, 7, 10, 4, 7, 8, 0, 1, 2, 9, 10, 11, 5, 8, 9, 12, 6, 7, 10, 11, 12, 8, 9, 10, 0, 3, 4, 13, 1, 2, 5, 6, 11, 3, 4, 9, 14, 0, 1, 10, 11, 12, 2, 7, 8, 13, 5, 6, 9, 12, 13, 7, 10, 11, 14, 15, 16, 14
Offset: 0

Views

Author

Alex Abercrombie, Feb 15 2008

Keywords

Comments

Sequence yielding an ordering of N*N derived from a family of recurrences.
For any integer k define h(k,1)=k and for m>1 define h(k,m)=h(k,m-1)+2*((-h(k,m-1)) mod m) where "r mod s" denotes least nonnegative residue of r modulo s [informally, h(k,m) is got by "reflecting" h(k,m-1) in the least multiple of m that is >=h(k,m-1)]. Then for fixed k>=0 there are integers c(k), b(k), m(k) such that for all m>m(k) we have h(k,2*m+1)-h(k,2*m)=2*c(k) and h(k,2*m+2)-h(k,2*m+1)=2*b(k). [In the terms of the function d defined in the Name, c(k) = d(k, 2*m+1) and b(k) = d(k, 2*m+2) for all m>m(k).]
For all n we have c(2*n+1)=c(2*n) and b(2*n+1)=1+b(2*n). Moreover b(2*n) is even for all n. The function n->(c(2*n),b(2*n)/2) is a bijection from the nonnegative integers N to N*N [as well as n->(b(n),c(n))]. It is "monotone" in the sense that n<=n' whenever c(2*n)<=c(2*n') and b(2*n)<=b(2*n').
This sequence is a(n) = c(2*n).
The results on which the definition is based are not yet proved, but they are plausible and overwhelmingly supported by numerical evidence.
For each fixed m, k->h(k,m) is a bijection Z->Z (this is easy!). However for k<0 the sequence h(k,m) does not have the pseudo-periodic property we have used in defining c(k) and b(k).
m(k) appears to be O(sqrt k).
From Andrey Zabolotskiy, Dec 28 2024: (Start)
See my Github link for the proof that the sequence is indeed well-defined.
That fact is equivalent to the quantity d(k,m) + d(k,m+1) eventually becoming constant. That constant value can be first reached when m is odd (case B) or even (case C).
On the plane (b(k), c(k)), the points from case B (resp. case C) fall in the region which is approximately the octant b(k) > c(k) (resp. c(k) > b(k)).
On the plane (x=n, y=a(n)), the graph of this sequence fills in a certain region in the plane. It's bounded from below by the line y=0 and from above, it seems, by the curve y = sqrt(Pi*x). That region, it seems, is further divided into two parts: the one below the curve y = sqrt((4/Pi)*x) contains points from case B, the one above it contains points from case C. The latter part looks more dense on the graph. (End)

Examples

			h(18,m) for m>=1 goes 18,18,18,22,28,32,38,42,48...so we can take m(18) = 2, then 2*c(18)=28-22=38-32=48-42=...=6, so a(9) = c(18) = 3 and similarly b(18) = 2.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{h = 2 n, b, c = 0, m = 1},
       While[Ceiling[h/(m+1)] != Floor[h/m],
        m++; b = Mod[-h, m]; h += 2 b;
        m++; c = Mod[-h, m]; h += 2 c];
       c];
    Table[a[n], {n, 0, 93}] (* Andrey Zabolotskiy, Apr 29 2023, Dec 25 2024 *)
  • Python
    def a(n):
        h, m, c = 2*n, 1, 0
        while (h+m)//(m+1) != h//m:
            m += 1; b = (-h) % m; h += 2*b
            m += 1; c = (-h) % m; h += 2*c
        return c
    print([a(n) for n in range(30)]) # Andrey Zabolotskiy, Dec 25 2024

Formula

It appears that a(n) = A319573(A252448(2*n+1)) [discovered by Sequence Machine], moreover, c(n) = A319573(n') and b(n) = A319572(n') with n' = A252448(n), where b and c are described above. - Andrey Zabolotskiy, Apr 28 2023

Extensions

Edited by Andrey Zabolotskiy, Apr 29 2023
Showing 1-3 of 3 results.