Odious Number

Author

Eric W. Weisstein
January 13, 2005

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

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

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

Code

OdiousQ[n_Integer?NonNegative]:=Mod[DigitCount[n,2,1],2]==1

Enumeration

Select[Range[0,100],OdiousQ]

<<Utilities`Plot`

Show[PixelPerfect[NaryPlot[Select[Range[0,512],OdiousQ]],BlockSize->2]]

Generating Functions

Generating Function

Product[1-x^(2^l),{l,0,k-1}]

1+Sum[With[{t=x^2^k},t(2+2t+5t^2-t^4)/(1-t^2)^2] Product[1-x^(2^l),{l,0,k-1}],{k,0,∞}]

FullSimplify[%118]

Series[1+Sum[With[{t=x^2^k},t(2+2t+5t^2-t^4)/(1-t^2)^2] Product[1-x^(2^l),{l,0,k-1}],{k,0,10}],{x,0,10}]

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

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

Subtract[((2-3 x)/(1-3 x+2 (x^2))),(1/(1-2 x))+(1/(1-x))]//Simplify

ExponentialGeneratingFunction

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

DirichletGeneratingFunction

Sum[((a[n])/(n^s)),{n,∞}]

Lambert Series

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

Recurrence

FindLinearRecurrence[{1,2,4,7,8,11,13,14,16,19,21,22,25,26,28,31,32,35,37,38,41}]

a(0) = 1, a(2n) = a(n) + 2n, a(2n+1) = -a(n) + 6n + 3.

a[0]:=1
a[n_]:=a[n/2]+n /; Mod[n,2]==0
a[n_]:=-a[(n-1)/2]+3(n-1)+3/; Mod[n,2]==1

a/@Range[0,10]

RecurrenceTable[{a[0]==1,
a[n]==Piecewise[{
{a[n/2]+n , Mod[n,2]==0},
{-a[(n-1)/2]+3(n-1)+3,Mod[n,2]==1}
}]},a[n],{n,1,10}]

RecurrenceTable[{a[0]==1,a[2n]==a[n]+2n,a[2n+1]==-a[n]+6n+3},a[n],{n,1,10}]

a[0]:=1
a[n_]:=Piecewise[{
{a[n/2]+n , Mod[n,2]==0},
{-a[(n-1)/2]+3(n-1)+3,Mod[n,2]==1}
}]

a/@Range[10]