Movatterモバイル変換


[0]ホーム

URL:


Nimbers Redux

 Michon
 

Related articles on this site:

Related Links (Outside this Site)

Mathematical Games.  |  Games in the Classroom.
Clever Games byNancy Casey(Los AlamosMegaMath,withbeta site in Idaho).
Combinatorial Game Theory(includingClobber)byDavid Wolfe (UC Berkeley).
Dotsand Boxes (Google Web Directory).
Games and Puzzles Page atcut-the-knot.com.
Combinatorial Game Theory byDavid Eppstein (UC Irvine).
Octal GamesbyAchim Flammenkamp(Universität Bielefeld).
Games Mathematicians Play byGregory McColm(University of South Florida).
Gamesof No Chance (Downloadable Articles) edited by Richard Nowakowski.
Combinatorial GamesbyThane Plambeck. | AOL: Combinatorial Game Theory.
 
border
border

Nim Arithmetic

Notations:  

4 + 6=2 100 +110=10
[ 4 + 6 ]=10 [100 +110 ]=1010


(2007-06-02)  
Extending bitwise addition to ordinary rational numbers.

We may investigate what happens when bitwise (exclusive-or) addition isapplied to thebinary expansions of ordinaryfractions.  (Those areultimately periodic.)

Adding bitwise two periodic expansionsof periods p and q yields an expansion whose period divides thelowest common multiple (LCM) of p and q. 

    [1/3]     =0.010101010101010101010101...    [1/5]     =0.001100110011001100110011...[1/3] + [1/5] =0.011001100110011001100110...    [2/5]     =0.011001100110011001100110...

Therefore, [1/3] + [1/5] = [2/5].  Equivalently, [1/5] + [2/5] = [1/3]

The nonzero fractions whose denominator isa power of 2, havetwobinary expansions (one ending with infinitely many zeros, the other endingwith infinitely many ones).  The issue is resolved by introducing the binary antizero 0 :

0    = ....111111111111111111.111111111111111111...

Note that if we add (in the ordinary sense) any nonzero number to0,we obtain that same number, represented either by its unique binaryexpansion or by one of two equivalent ones, (Indeed, adding0 in the ordinary way lets you switch fromone such representation to the other.) With ordinary arithmetic, there's no difference (literally!) between 0 and0 or between  ½  and [ 0+½ ]. With Nim-arithmetic, on the other hand,0 cannot be eliminatedexcept with the use of a unary  minus (there's no need for a binary minus operator, since addition and subtractionare the same operation).  The relation to remember is:

x + [-x]   =  0   =   -0

So, the antizero 0 may also be called  "-0"  (minus zero).

0     = ....111111111111111111.111111111111111111...   [-1]    = ....111111111111111111.000000000000000000... [-1] +0  = ....000000000000000000.111111111111111111...[1/3] +0  = ....111111111111111111.101010101010101010...  [-1/3]   = ....111111111111111111.101010101010101010...

Nim-addition endows thebinary expansions with the structureof a group  (each expansion is its own opposite). We call such a binary expansion a nimber.  One or twonimbers areassociated with each number.

Nimbers form an Abelian group under Nim-addition. The subgroups correspond to fractions with a binary period thatdivides a given n.  Those are fractions whose denominators are divisorsof  2n-1. They are of the form [x+y/(2n-1)] where y is an integer from  0  to  2n-1. (both extremes being excluded if we rule out numbers whose denominatorsare powers of 2). The structure is thus homomorphic to a simple cartesianproduct of two groups:  The integernimbers on one hand(to which x belongs) and, on the other hand, the finite group of 2n  integernimbers to which  y  belongs.

 Come back later, we're still working on this one...

' Nim-addition generalized to positive fractions in UBASIC:'fnSim(X,Y)local D,N,Z,SS=1:while or{even(den(X)),even(den(Y))}:X*=2:Y*=2:S*=2:wend'Both denominators are now odd.  Divisor S is a power of 2.D=lcm(den(X),den(Y))if D>1 then Z=2:N=1:while Z<>1:inc N:Z=(Z+Z)@D:wend:D=2^N-1N=floor(X):X=X-NZ=floor(Y):Y=Y-ZZ=bitxor(N,Z)+bitxor(num(X)*D\den(X),num(Y)*D\den(Y))//Dreturn(Z//S)
 Denominator  BinaryPeriod  Mersenne Multiple 
111
323
5415
737
9663
11101023
13124095
15415
178255
1918262143
21663
23112047
25201048575
2718262143
2928268435455
31531
33101023
35124095
373668719476735
39124095
41201048575
431416383
45124095
47238388607
49212097151
518255
53524503599627370495
55201048575
5718262143
5958288230376151711743
61601152921504606846975
63663
65124095
676673786976294838206463
69224194303
713534359738367
739511
75201048575
77301073741823
7939549755813887
815418014398509481983
83824835703278458516698824703
858255
8728268435455
89112047
91124095
93101023
953668719476735
9748281474976710655
99301073741823
1011001267650600228229401496703205375
103512251799813685247
105124095
10710681129638414606681695789005144063
1093668719476735
1113668719476735
11328268435455
 

Recall that along primeto some base of numeration is aprime p whose inverse 1/p has period p-1 in that base. In binary, the long primes are:

3, 5, 11, 13, 19, 29, 37, 53, 59, 61, 67, 83, 101, 107, 131, 139,149, 163, 173, 179, 181, 197, 211, 227, 269, 293, 317, 347, 349,373, 379, 389, 419, 421, 443, 461, 467, 491, 509, 523, 541, 547,557, 563, 587, 613, 619, 653, 659, 661, 677, 701, 709, 757, 773,787, 797, 821, 827, 829, 853, 859, 877, 883, 907, 941, 947...  (A001122)

Likewise, here are the prime numbers  p  whose binary periods are  (p-1)/2 :

7, 17, 23, 41, 47, 71, 79,97, 103, 137, 167, 191, 193, 199, 239, 263, 271, 311, 313, 359, 367, 383, 401, 409,449, 463, 479, 487, 503, 521, 569, 599, 607, 647, 719, 743, 751, 761, 769, 809, 823,839, 857, 863, 887, 929, 967, 977, 983, 991, 1009, 1031, 1033, 1039...  (A115591)

By Fermat's little theorem, the binary period of a prime  p  divides  p-1. Composite numbers for which this is true are the  (rare) pseudoprime  to base 2. The smallest of these is  341 = 11×13,  whose binary period is 10:

Binary periods of Poulet numberss  (Carmichael numbers  are in bold type)
A00156734156164511051387172919052047246527012821
Period1040282418362811563660

For example,  953 is prime.  So, its binary period divides  952 = 23. 7 . 17. It's actually  68 = 22. 17  because the following characterization holds:

953  divides  268-1  but divides neither  268/2-1  nor  268/17-1.

The period of a product of integers divides the LCM  of their periods.


(2007-06-05)  
Extending nim-multiplication  to ordinary rational numbers.

All we have to do is define the product of two 2-powers. Among integers, this is done by specifying that theproduct of a Fermat 2-power by any lesser integer is equal to their ordinary product.

Let's introduce  [½]  into the picture. The product of  ½  by any integer can't bean integer  (or else multiplying the result by the inverseof that integer would yield an integer instead of  ½ as it should).  More generally,  [½] cannot be the root of any quadratic polynomial with integer coefficients (the integernimbers are quadratically closed). 

[ 1/2] 3   =   2           [ 1/2] 2  =   [ 1/4]
[ 1/8] 3  =   [ 1/2]
[ 1/512] 3  =   [ 1/8]

border
border
visits since April 13, 2020
 (c) Copyright 2000-2020, Gerard P. Michon, Ph.D.

[8]ページ先頭

©2009-2025 Movatter.jp