A265667 Permutation of nonnegative integers: a(n) = n + floor(n/3)*(-1)^(n mod 3).
0, 1, 2, 4, 3, 6, 8, 5, 10, 12, 7, 14, 16, 9, 18, 20, 11, 22, 24, 13, 26, 28, 15, 30, 32, 17, 34, 36, 19, 38, 40, 21, 42, 44, 23, 46, 48, 25, 50, 52, 27, 54, 56, 29, 58, 60, 31, 62, 64, 33, 66, 68, 35, 70, 72, 37, 74, 76, 39, 78, 80, 41, 82, 84, 43, 86, 88, 45
Offset: 0
Examples
------------------------------------------------------------------------- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, ... + + + + + + + + + + + + + + + + + + + 0, 0, 0, 1, -1, 1, 2, -2, 2, 3, -3, 3, 4, -4, 4, 5, -5, 5, 6, ... ------------------------------------------------------------------------- 0, 1, 2, 4, 3, 6, 8, 5, 10, 12, 7, 14, 16, 9, 18, 20, 11, 22, 24, ... -------------------------------------------------------------------------
Links
- Bruno Berselli, Table of n, a(n) for n = 0..1000
- Peter Lynch and Michael Mackey, Parity and Partition of the Rational Numbers, arXiv:2205.00565 [math.NT], 2022. See set F p. 4.
- Index entries for linear recurrences with constant coefficients, signature (0,0,2,0,0,-1).
- Index entries for permutations of the positive (or nonnegative) integers.
Crossrefs
Programs
-
Magma
[n+Floor(n/3)*(-1)^(n mod 3): n in [0..70]];
-
Mathematica
Table[n + Floor[n/3] (-1)^Mod[n, 3], {n, 0, 70}]
-
Sage
[n+floor(n/3)*(-1)^mod(n,3) for n in (0..70)]
Formula
G.f.: x*(1 + 2*x + 4*x^2 + x^3 + 2*x^4) / ((1 - x)^2*(1 + x + x^2)^2).
a(n) = 2*a(n-3) - a(n-6).
a(3*k) = 4*k;
a(3*k+1) = 2*k+1, hence a(3*k+1) = a(3*k)/2 + 1;
a(3*k+2) = 4*k+2, hence a(3*k+2) = 2*a(3*k+1) = a(3*k) + 2.
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/8 + log(2)/4. - Amiram Eldar, Mar 30 2023
Comments