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.

This page as a plain text file.
%I A327119 #35 Jul 17 2023 15:17:58
%S A327119 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,
%T A327119 39,11,48,28,44,30,76,21,51,26,62,36,53,25,69,40,55,42,75,24,65,46,97,
%U A327119 35,63,33,94,52,71,43,95,37,87,58,90,60,89,32,167,50,84
%N 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.
%C A327119 The first term must be omitted because it does not converge.
%C A327119 Start with the sequence of nonnegative integers [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...].
%C A327119 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).
%C A327119 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).
%C A327119 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).
%C A327119 Continue for all values of k.
%C A327119 a(n) is equivalent to -A327093(-n), if A327093 is extended to all integers.
%C A327119 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
%H A327119 Jennifer Buckley, <a href="/A327119/b327119.txt">Table of n, a(n) for n = 1..10000</a>
%F A327119 a(n) = A004442(A327420(n)) (conjectured). - _Jon Maiga_, May 31 2021
%o A327119 (Go)
%o A327119 func a(n int) int {
%o A327119     for k := n; k > 0; k-- {
%o A327119         if n%k == 0 {
%o A327119             if (n/k)%2 == 0 {
%o A327119                 n = n + k
%o A327119             } else {
%o A327119                 n = n - k
%o A327119             }
%o A327119         }
%o A327119     }
%o A327119     return n
%o A327119 }
%Y A327119 Cf. A004442, A327093, A327420.
%Y A327119 Inverse: A327120.
%K A327119 nonn
%O A327119 1,3
%A A327119 _Jennifer Buckley_, Sep 13 2019