Processing math: 100%

Thursday, February 9, 2023

Base b and generating functions

 Not a puzzle, just a quick observation noting the power of generating functions.


Say b2 is a positive integer. We give a quick proof using generating functions that every positive integer can be written uniquely in base b with digits 0,1,,b1.


Let n1. Consider 

G(x)=nk=0(1+xbk+x2bk++x(b1)bk)

Observe that the coefficient of xN shows the numbers of ways of writing N is base b.

Now if u=xbk, then

(1+xbk+x2bk++x(b1)bk)=(1+u+u2+ub1)=1ub1u


Thus

G(x)=1xb1x1xb21xb1xb31xb21xbn+11xbn


This telescopes to


G(x)=1xbn+11x

=1+x+x2++xbn+11

Thus every integer N in the range 1 to bn+11, can be written in base b using at-most n+1 digits, taken from 0,1,2,,b1. Since the coefficient of xN is 1, the representation is unique.


No comments:

Post a Comment