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.

A327119 Sequence obtained by swapping each (k*(2n))-th element of the nonnegative integers with the (k*(2n+1))-th element, for all k>0 in ascending order, omitting the first term.

Original entry on oeis.org

0, 1, 3, 2, 7, 4, 8, 6, 14, 5, 15, 10, 20, 12, 17, 9, 34, 16, 27, 18, 31, 13, 29, 22, 47, 19, 39, 11, 48, 28, 44, 30, 76, 21, 51, 26, 62, 36, 53, 25, 69, 40, 55, 42, 75, 24, 65, 46, 97, 35, 63, 33, 94, 52, 71, 43, 95, 37, 87, 58, 90, 60, 89, 32, 167, 50, 84
Offset: 1

Views

Author

Jennifer Buckley, Sep 13 2019

Keywords

Comments

The first term must be omitted because it does not converge.
Start with the sequence of nonnegative integers [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...].
Swap all pairs specified by k=1, resulting in [1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, ...], so the first term of the final sequence is 0 (No swaps for k>1 will affect this term).
Swap all pairs specified by k=2, resulting in [3, 0, 1, 2, 7, 4, 5, 6, 11, 8, 9, ...], so the second term of the final sequence is 1 (No swaps for k>2 will affect this term).
Swap all pairs specified by k=3, resulting in [2, 0, 1, 3, 7, 4, 8, 6, 11, 5, 9, ...], so the third term of the final sequence is 3 (No swaps for k>3 will affect this term).
Continue for all values of k.
a(n) is equivalent to -A327093(-n), if A327093 is extended to all integers.
It appears that n is an odd prime number iff a(n+1)=n-1. If true, is there a formal analogy with the Sieve of Eratosthenes (by swapping instead of marking terms), or is this another type of sieve? - Jon Maiga, May 31 2021

Crossrefs

Inverse: A327120.

Programs

  • Go
    func a(n int) int {
        for k := n; k > 0; k-- {
            if n%k == 0 {
                if (n/k)%2 == 0 {
                    n = n + k
                } else {
                    n = n - k
                }
            }
        }
        return n
    }

Formula

a(n) = A004442(A327420(n)) (conjectured). - Jon Maiga, May 31 2021