login
A004458
Nimsum n + 17.
1
17, 16, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 49, 48, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 63, 62, 33, 32, 35, 34, 37, 36, 39, 38, 41, 40, 43, 42, 45, 44, 47, 46, 81, 80, 83
OFFSET
0,1
COMMENTS
A self-inverse permutation of the natural numbers. - Philippe Deléham, Nov 22 2016
REFERENCES
E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.
FORMULA
a(n) = n + (-1)^n + 16*(-1)^[n/16]. - Mitchell Harris, Jan 10 2005
G.f.: (17-x-14*x^2-15*x^16-x^17+18*x^18) / ((1-x)^2*(1+x)*(1+x^16)). - Colin Barker, Apr 12 2016
a(n) = n XOR 17. - Michel Marcus, Apr 12 2016
MATHEMATICA
BitXor[Range[0, 100], 17] (* Paolo Xausa, Apr 20 2026 *)
PROG
(Haskell)
import Data.Bits (xor)
a004458 n = n `xor` 17 :: Integer -- Reinhard Zumkeller, Nov 07 2012
(PARI) Vec((17-x-14*x^2-15*x^16-x^17+18*x^18)/((1-x)^2*(1+x)*(1+x^16)) + O(x^50)) \\ Colin Barker, Apr 12 2016
(PARI) a(n) = n + (-1)^n + 16*(-1)^(n\16); \\ Michel Marcus, Apr 12 2016
CROSSREFS
Cf. A004442.
Sequence in context: A261306 A022973 A023459 * A082123 A368929 A273973
KEYWORD
nonn,easy
STATUS
approved