IntegerReverse

IntegerReverse[n]

gives the integer whose digits are reversed with respect to those of the integer n.

IntegerReverse[n,b]

gives the integer whose digits in base b are reversed with respect to those of n.

IntegerReverse[n,b,len]

gives the integer with reversed digits after padding n with zeros on the left to have len digits.

Details

Examples

open allclose all

Basic Examples  (3)

Reverse the digits of an integer:

In[1]:=
Click for copyable input
Out[1]=

Reverse the binary digits of an integer:

In[1]:=
Click for copyable input
Out[1]=

The result coincides with the input because that number is a binary palindrome:

In[2]:=
Click for copyable input
Out[2]=

Reverse the digits of an integer after padding it with zeros on the left:

In[1]:=
Click for copyable input
Out[1]=

Scope  (5)

Applications  (2)

Properties & Relations  (3)

See Also

IntegerDigits  FromDigits  Reverse  PalindromeQ  IntegerLength

Introduced in 2015
(10.3)