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.
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
Keywords
Links
- Jennifer Buckley, Table of n, a(n) for n = 1..10000
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 }
Comments