Least Significant Bit

Author

Eric W. Weisstein
October 18, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/IntegerSequences/LeastSignificantBit.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/LeastSignificantBit.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Code

LeastSignificantBit[n_]:=Mod[n,2]

Sequence

Table[IntegerDigits[n,2][[-1]],{n,20}]

Table[(1-(-1)^n)/2,{n,20}]

Table[Mod[n,2],{n,20}]

Recurrence

V4.2

RSolve[{a[n]==1-a[n-1],a[1]==1},a[n],n]

V5.0

RSolve[{a[n]==1-a[n-1],a[1]==1},a[n],n]

V7

RSolve[{a[n]==1-a[n-1],a[1]==1},a[n],n]

Generating Functions

Generating Function

Sum[(1-(-1)^n)/2x^n,{n,∞}]//FullSimplify

GeneratingFunction[(1-(-1)^n)/2,n,z]//FullSimplify

ExponentialGeneratingFunction

Sum[(1-(-1)^n)/2((x^n)/(n!)),{n,0,∞}]//FullSimplify

DirichletGeneratingFunction

Sum[(((1-(-1)^n)/2)/(n^s)),{n,∞}]//FullSimplify

Lambert Series

Sum[(((1-(-1)^n)/2(x^n))/(1-(x^n))),{n,∞}]

Plot

V5

FilledListPlot[Table[Mod[n,2],{n,50}],AxesLabel->TraditionalForm/@{n,LSB[n]}]

V7

DiscretePlot[LeastSignificantBit[n],{n,50},Filling->Axis,Joined->True,AxesLabel->{n,LSB[n]}]