login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A004468 a(n) = Nim product 3 * n. 4

%I #40 Mar 07 2023 16:22:28

%S 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,

%T 53,54,56,59,57,58,16,19,17,18,28,31,29,30,20,23,21,22,24,27,25,26,32,

%U 35,33,34,44,47,45,46,36,39,37,38,40,43,41,42,192,195,193,194,204,207,205

%N a(n) = Nim product 3 * n.

%C From _Jianing Song_, Aug 10 2022: (Start)

%C Write n in quaternary (base 4), then replace each 1,2,3 by 3,1,2.

%C This is a permutation of the natural numbers; A006015 is the inverse permutation (since the nim product of 2 and 3 is 1). (End)

%D J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.

%H Alois P. Heinz, <a href="/A004468/b004468.txt">Table of n, a(n) for n = 0..16383</a> (first 1001 terms from R. J. Mathar)

%H <a href="/index/Ni#Nimmult">Index entries for sequences related to Nim-multiplication</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F a(n) = A051775(3,n).

%F From _Jianing Song_, Aug 10 2022: (Start)

%F a(n) = 3*n if n has only digits 0 or 1 in quaternary (n is in A000695). Otherwise, a(n) < 3*n.

%F a(n) = n/2 if n has only digits 0 or 2 in quaternary (n is in A062880). Otherwise, a(n) > n/2.

%F 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)

%p read("transforms") ;

%p # insert Maple procedures nimprodP2() and A051775() of the b-file in A051775 here.

%p A004468 := proc(n)

%p A051775(3,n) ;

%p end proc:

%p L := [seq(A004468(n),n=0..1000)] ; # _R. J. Mathar_, May 28 2011

%p # second Maple program:

%p a:= proc(n) option remember; `if`(n=0, 0,

%p a(iquo(n, 4, 'r'))*4+[0, 3, 1, 2][r+1])

%p end:

%p seq(a(n), n=0..70); # _Alois P. Heinz_, Jan 25 2022

%t a[n_] := a[n] = If[n == 0, 0, {q, r} = QuotientRemainder[n, 4]; a[q]*4 + {0, 3, 1, 2}[[r + 1]]];

%t Table[a[n], {n, 0, 70}] (* _Jean-François Alcover_, May 20 2022, after _Alois P. Heinz_ *)

%o (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

%o (Python)

%o def a(n, D=[0, 3, 1, 2]):

%o r, k = 0, 0

%o while n>0: r+=D[n%4]*4**k; n//=4; k+=1

%o return r

%o # _Onur Ozkan_, Mar 07 2023

%Y Row 3 of array in A051775.

%Y Cf. A006015, A004469-A004480, A000695, A062880, A001196.

%K nonn,easy,look

%O 0,2

%A _N. J. A. Sloane_

%E More terms from _Erich Friedman_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 18:58 EDT 2024. Contains 371798 sequences. (Running on oeis4.)