[Question]
  [
Write a full program to find whether the binary representation of a number is palindrome or not?
```
Sample Input
5
Sample Output
YES
```
Print `YES` if binary representation is palindrome and `NO` otherwise.
  
[Answer]
## Python - 46 chars
```
n=bin(input())[2:]
print'YNEOS'[n!=n[::-1]::2]
```
[Answer]
## Golfscript -- 22 chars
```
~2base.-1%="YES""NO"if
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 85 [bitsv1](https://github.com/Vyxal/Vyncode/blob/main/README.md), 10.625 bytes
*-6 bits thanks to @lyxal*
*-3 bits thanks to @the-thonnu*
```
bḂ≠`∨ȯno`½iN
```
[Try it Online!](https://vyxal.pythonanywhere.com/?v=1#WyJBPSIsIiIsImLhuILiiaBg4oioyK9ub2DCvWlOIiwiIiwiMVxuMlxuM1xuNFxuNVxuNlxuN1xuOFxuOVxuMTBcbjExXG4xMlxuMTNcbjE0XG4xNSJd)
```
b            # binary of input
 Ḃ≠          # is not equal to its reverse (essentially: is not a palindrome?)
   `∨ȯno`    # compressed string `yesno`
         ½   # split into two strings of equal length
          i  # index that inequality (0/1) into that
           N # case swapped to uppercase
```
[Answer]
## Ruby, 41 39
```
$><<%w(YES NO)[(n="%b"%$*)<=>n.reverse]
```
Thanks to Michael Kohl's "%b"%gets trick. 
[Answer]
**C 84 81 74 Characters**
```
r;main(v,x){for(scanf("%d",&v),x=v;v;v/=2)r=r*2|v&1;puts(r-x?"NO":"YES");}
```
It does not use any function like string reverse.
[Answer]
## Javascript - 79 77 chars
```
alert((a=(prompt()*1).toString(2))-a.split("").reverse().join("")?"NO":"YES")
```
**More information**
`prompt()*1` : Quick trick to convert string to number. 
`.toString(2)` : That's how you convert to binary in javascript.
`a.split("").reverse().join("")` : There is no native support to reverse string, so you have to convert string to array and array to string. 
`("[part1]" - "[part 2]")?"YES":"NO"` : `-` is a replacement for `!=` to save 1 char.
[Answer]
# PHP - 41
```
<?=strrev($n=decbin(`cat`))==$n?@YES:@NO;
```
Test:
```
php 713.php <<< 5
YES
php 713.php <<< 6
NO
```
[Answer]
# Perl, 45 characters
```
$_=sprintf'%b',shift;
print reverse==$_?YES:NO
```
[Answer]
**Ruby, 43 characters**
```
puts((n="%b"%gets)==n.reverse ? "YES":"NO")
```
[Answer]
## Windows PowerShell, 67
```
('NO','YES')[($a=[Convert]::ToString("$input",2))-eq-join$a[64..0]]
```
[Answer]
# 05AB1E, ~~17~~ 12 bytes
```
‘NO…Ü‘#EbÂQè
```
*-5 bytes thanks to Adnan.*
[Try it online!](http://05ab1e.tryitonline.net/#code=4oCYTk_igKbDnOKAmCNFYsOCUcOo&input=NQ)
[Answer]
# JavaScript, 75 bytes 69 bytes
```
alert((a=[...(+prompt()).toString(2)]).some(x=>x-a.pop())?"NO":"YES")
```
[Try it online!](https://tio.run/##DcoxCoAwDADAt5gpRezgKFQnVx2cHIMWqagJbZD@vroed9JLaYtBtHl496XQ5aMiksNaIt@iaIxVXjSG58DW2CRXUAT4OfHtMbs@V46ssPx1gGmGDtZxAVPKBw)
A different approach from [HoLyVieR's](https://codegolf.stackexchange.com/users/54/holyvier) solution
**Explanation**
`+prompt()` : Converts string to number
`[...s]` : converts a string `s` to an array of chars
`.some((x) => x - a.pop())` : checks whether there is one element in the array that does not equal the last element of the array
**Edit**
69 chars, thanks to the suggestions by [Shaggy](https://codegolf.stackexchange.com/users/58974/shaggy)
[Answer]
# [Arturo](https://arturo-lang.io), 47 bytes
```
print(=reverse<=as.binary do arg\0)?->'YES->'NO
```
[Answer]
## Python (51)
```
n=bin(input())[2:]
print'YES'if n==n[::-1]else'NO'
```
[Answer]
# Perl (73)
No string reverse:
```
print f(split//,sprintf'%b',shift);
sub f{@_<=1?YES:shift!=pop()?NO:f(@_)}
```
[Answer]
# Perl (127)
This one constructs all palindromes up to 2^32.
```
sub f{
    my($x,$l)=@_;
    $l+=2,f(($x<<$_)+1+(1<<$l-1),$l)?return 1:0 for 1..15-$l/2;
    $x-$ARGV[0]?0:1
}
print f(0,1)+f(0,0)+f(1,1)?YES:NO
```
[Answer]
## Bash, 55 chars
```
C=`dc<<<$1\ 2op`;[ $C = `rev<<<$C` ]&&echo YES||echo NO
```
[Answer]
## J - 33 characters
```
13 : ';(]-:|.)#:y{''YES'';''NO'''
```
[Answer]
## J: 24
```
((-:|.)#:x){2 3$'NO YES'
```
eg:
```
   ((-:|.)#:5){2 3$'NO YES'
YES
   ((-:|.)#:12){2 3$'NO YES'
NO
   ((-:|.)#:125){2 3$'NO YES'
NO
   ((-:|.)#:63){2 3$'NO YES'
YES
```
[Answer]
## Haskell (79)
```
0?k=n;n?k=div n 2?(n`mod`2+k*2);f x|x==x?0="YES"|True="No";main=interact$f.read
```
[Answer]
## C (77 bytes)
```
r,t;main(n){for(t=n=atoi(gets(&n));n;r*=2,r|=n%2,n/=2);puts(r-t?"NO":"YES");}
```
[TEST](http://ideone.com/yFzEX)
[Answer]
## Pyth, 18 bytes
```
%2>"YNEOS"!qJ.BQ_J
```
Also 18 bytes:
```
@,"NO""YES"qJ.BQ_J
```
[Answer]
# PHP, not competing
I wanted to do it without using strings at all.
iterative solution, 78 bytes
```
for($x=log($n=$argv[1],2);$i<$x&($n>>$i^$n>>$x-$i^1);$i++);echo$i<$x/2?NO:YES;
```
recursive solution, 113 bytes
```
function p($n,$x=0){return$n<2?$n:is_pal(($n&(1<<$x=log($n,2)/2)-1)^$n>>$x+!is_int($x));}echo p($argv[1])?YES:NO;
```
If `n` is a binary palindrome, the upper half xor the lower half is also a binary palindrome and vice versa.
---
a port of the excellent [C answer from fR0DDY](https://codegolf.stackexchange.com/q/722#722), 58 bytes
```
for($x=2*$v=$argv[1];$x/=2;$r=$r*2|$x&1);echo$r-$v?NO:YES;
```
a binary reverse. Columbus´ egg.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 12 bytes (non-competing)
```
BṚ⁼Bị“YES“NO
```
[Try it online!](https://tio.run/nexus/jelly#@@/0cOesR417nB7u7n7UMCfSNRhI@vn////fFAA "Jelly – TIO Nexus")
Explanation:
```
BṚ⁼Bị“YES“NO Main link. Arguments: z.
B            Binary representation of z.
 Ṛ           Reversed.
   B         Binary representation of z.
  ⁼          Check if x is equal to y.
     “YES“NO [['Y', 'E', 'S'], ['N', 'O']]
    ị        xth element of y (1-indexed).
```
Before printing, Python's `str` function is mapped through a list, and then the elements are concatenated, so you see `YES` or `NO`.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 46 bytes
```
If[PalindromeQ@IntegerDigits[#,2],"YES","NO"]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2773zMtOiAxJzMvpSg/NzXQwTOvJDU9tcglMz2zpDhaWccoVkcp0jVYSUfJz18pVu1/QFFmXomCQ3q0aez//wA "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Arn](https://github.com/ZippyMagician/Arn), [16 bytes](https://github.com/ZippyMagician/Arn/wiki/Carn)
```
±î«Áýãf©¯tvf–É‰2
```
[Try it!](https://zippymagician.github.io/Arn?code=IllFUyJeKD1cfDo7Yil8fCJOTw==&input=NQo3CjE0)
# Explained
Unpacked: `"YES"^(=\|:;b)||"NO`. Man that yes/no required output really killed my byte count
```
    "YES"         String
  ^               Repeated
    (             Begin expression
        \         Fold with...
      =           ...equality
          |:      Bifurcate
              _   Variable initialized to STDIN; implied
            ;b    Binary representation
    )             End expression
||                Boolean OR
  "NO             String, ending quote implied
```
This works because empty strings are falsey.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 16 bytes
```
?q_K.BQK"YES""NO
```
[Try it online!](https://tio.run/##K6gsyfj/374w3lvPKdBbKdI1WEnJz///f1MA "Pyth – Try It Online")
```
?q_K.BQK"YES""NO
   K.BQ          // Assign binary input to K
?q_K   K         // Evaluate whether K and reversed K are equal
        "YES""NO // Ternary output.
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 23 bytes ([SBCS](https://github.com/abrudz/SBCS))
```
'NO' 'YES'⊃⍨≡∘⌽⍨2⊥⍣¯1⊢⎕
```
-3 bytes from Bubbler, after fitting the question requirements.
Instead of performing an if-else like below, this program uses APL's representation of true as 1 and false as 0 to select from an array, where 'NO' is in the 0th index and 'YES' is in the first index.
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qG@qp/@jtgkGXI862tO4HvXOrdZ41LP3UefCR12LNI0edS191Lv40HpDIO9R71Yr9UjXYPVH3S3qfv7qtUC9/0EMBYhoV/Oj3hUgjR0zQCb0rkDVDVQMtOI/ZxqXKReQMDQAAA "APL (Dyalog Unicode) – Try It Online")
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 26 bytes ([SBCS](https://github.com/abrudz/SBCS))
```
{(⌽≡⊢)2(⊥⍣¯1)⍵:'YES'⋄'NO'}
```
## Explanation
```
{(⌽≡⊢)2(⊥⍣¯1)⍵:'YES'⋄'NO'}
{                        } function wrapper
             ⍵             take the right argument
      2(⊥⍣¯1)              convert to base 2, and split into -1 groups(gets all digits)
 (⌽≡⊢)                     reverse equals right expression?
              :'YES'⋄'NO'} if the above is true, display 'YES', otherwise 'NO'
```
[Try it online!](https://tio.run/##AV0Aov9hcGwtZHlhbG9n//97KOKMveKJoeKKoikyKOKKpeKNo8KvMSnijbU6J1lFUyfii4QnTk8nff9m4oaQ4o2O4oqD4o2s4o20wq8z4oaR4o6VU1JD4o6VVEhJU/9mIDU "APL (Dyalog Unicode) – Try It Online")
[Answer]
# [Retina](http://github.com/mbuettner/retina), ~~80~~ 78 bytes
Byte count assumes ISO 8859-1 encoding.
```
.+
$*
+`(1+)\1
${1}0
01
1
^((.)*?).??((?<-2>.)*$)
$1¶$3
O$^`.(?=.*¶)
^(.*)¶\1
```
[**Try it online**](http://retina.tryitonline.net/#code=LisKJCoKK2AoMSspXDEKJHsxfTAKMDEKMQpeKCguKSo_KS4_PygoPzwtMj4uKSokKQokMcK2JDMKTyReYC4oPz0uKsK2KQoKXiguKinCtlwx&input=NQ)
Convert to unary. Convert that to binary. Cut the number in half and remove a middle digit if there is one. Reverse the first half. Match if both halves are equal.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 13 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
¢è¬?`y`u:"NO
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=ouisP2B5g2B1OiJOTw&input=NQ)
]