DOCUMENTATION CENTER SEARCH
Mathematica
>
Bitwise Operations
>
Built-in
Mathematica
Symbol
Integer and Number Theoretic Functions
Tutorials »
|
BitClear
BitGet
BitLength
BitOr
ReplacePart
See Also »
|
Bitwise Operations
Cryptographic Number Theory
Integer Functions
Number Digits
New in 6.0: Mathematics & Algorithms
New in 6.0: Number Theory & Integer Functions
More About »
BitSet
BitSet
[
n
,
k
]
sets to 1 the bit corresponding to the coefficient of
in the integer
n
.
MORE INFORMATION
BitSet
[
n
,
k
]
sets the bit
k
places from the right.
EXAMPLES
CLOSE ALL
Basic Examples
(1)
Display coefficients at powers of 2 in the integer 42:
In[1]:=
Out[1]=
Set the bit corresponding to the coefficient at
2
0
to
1
:
In[2]:=
Out[2]=
In[3]:=
Out[3]=
Set the bit corresponding to the coefficient at
2
4
:
In[4]:=
Out[4]=
In[5]:=
Out[5]=
SEE ALSO
BitClear
BitGet
BitLength
BitOr
ReplacePart
TUTORIALS
Integer and Number Theoretic Functions
MORE ABOUT
Bitwise Operations
Cryptographic Number Theory
Integer Functions
Number Digits
New in 6.0: Mathematics & Algorithms
New in 6.0: Number Theory & Integer Functions
New in 6
© 2008 Wolfram Research, Inc.