login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A004468
a(n) = Nim product 3 * n.
4
0, 3, 1, 2, 12, 15, 13, 14, 4, 7, 5, 6, 8, 11, 9, 10, 48, 51, 49, 50, 60, 63, 61, 62, 52, 55, 53, 54, 56, 59, 57, 58, 16, 19, 17, 18, 28, 31, 29, 30, 20, 23, 21, 22, 24, 27, 25, 26, 32, 35, 33, 34, 44, 47, 45, 46, 36, 39, 37, 38, 40, 43, 41, 42, 192, 195, 193, 194, 204, 207, 205
OFFSET
0,2
COMMENTS
From Jianing Song, Aug 10 2022: (Start)
Write n in quaternary (base 4), then replace each 1,2,3 by 3,1,2.
This is a permutation of the natural numbers; A006015 is the inverse permutation (since the nim product of 2 and 3 is 1). (End)
REFERENCES
J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.
FORMULA
a(n) = A051775(3,n).
From Jianing Song, Aug 10 2022: (Start)
a(n) = 3*n if n has only digits 0 or 1 in quaternary (n is in A000695). Otherwise, a(n) < 3*n.
a(n) = n/2 if n has only digits 0 or 2 in quaternary (n is in A062880). Otherwise, a(n) > n/2.
a(n) = 2*n/3 if and only if n has only digits 0 or 3 in quaternary (n is in A001196). Proof: let n = Sum_i d_i*4^i, d(i) = 0,1,2,3. Write A = Sum_{d_i=1} 4^i, B = Sum_{d_i=2} 4^i, then a(n) = 2*n/3 if and only if 3*A + B = 2/3*(A + 2*B), or B = 7*A. If A != 0, then A is of the form (4*s+1)*4^t, but 7*A is not of this form. So the only possible case is A = B = 0, namely n has only digits 0 or 3. (End)
MAPLE
read("transforms") ;
# insert Maple procedures nimprodP2() and A051775() of the b-file in A051775 here.
A004468 := proc(n)
A051775(3, n) ;
end proc:
L := [seq(A004468(n), n=0..1000)] ; # R. J. Mathar, May 28 2011
# second Maple program:
a:= proc(n) option remember; `if`(n=0, 0,
a(iquo(n, 4, 'r'))*4+[0, 3, 1, 2][r+1])
end:
seq(a(n), n=0..70); # Alois P. Heinz, Jan 25 2022
MATHEMATICA
a[n_] := a[n] = If[n == 0, 0, {q, r} = QuotientRemainder[n, 4]; a[q]*4 + {0, 3, 1, 2}[[r + 1]]];
Table[a[n], {n, 0, 70}] (* Jean-François Alcover, May 20 2022, after Alois P. Heinz *)
PROG
(PARI) a(n) = my(v=digits(n, 4), w=[0, 3, 1, 2]); for(i=1, #v, v[i] = w[v[i]+1]); fromdigits(v, 4) \\ Jianing Song, Aug 10 2022
(Python)
def a(n, D=[0, 3, 1, 2]):
r, k = 0, 0
while n>0: r+=D[n%4]*4**k; n//=4; k+=1
return r
# Onur Ozkan, Mar 07 2023
CROSSREFS
Row 3 of array in A051775.
Sequence in context: A109528 A136125 A092580 * A254630 A145463 A144107
KEYWORD
nonn,easy,look
EXTENSIONS
More terms from Erich Friedman
STATUS
approved

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy