g | x | w | all
Bytes Lang Time Link
040TIBASIC TI84 Plus CE Python250911T163500Zmadeforl
038AWK250910T163307Zxrs
036SNOBOL4 CSNOBOL4230228T152907ZGiuseppe
007GolfScript230228T152715Zemirps
011Juby221204T170704ZJordan
004Pip221203T080615ZAiden Ch
041Leaf Lang220909T173332ZBreadlea
089CellTail220908T120300Zmousetai
028Julia220908T110806Zamelies
047Prolog SWI220827T164105ZnaffetS
nanFig220907T185807ZSeggan
032Julia220830T061910ZCzylabso
008CJam220830T105611ZChilling
028brev220831T081618ZSandra
002MathGolf220830T071954ZKevin Cr
097Desmos220829T192404Zthejonym
072JavaScript220827T105923ZLeaf
002Vyxal220827T045522Ztybocopp
005Burlesque200207T005305ZDeathInc
003Keg200206T074057Zlyxal
061Pepe190513T050130Zu-ndefin
010Runic Enchantments190513T013917ZDraco18s
002Ohm v2171010T021535ZNick Cli
033><>190308T113619ZEmigna
016APLNARS190308T100321Zuser5898
052Java 8190308T003840ZBenjamin
005APL Dyalog Unicode171117T130932ZJ. Sall&
021Gol><>180222T094919ZUnihedro
050Java 8171010T073039ZKevin Cr
024Ruby171010T045846ZYytsi
005MATL180220T201955ZB. Mehta
003Pyt180220T200049Zqqq
004Jelly180125T233418Zellie
022REXX171121T152005Zidrougge
005Implicit171012T160128ZMD XF
039><>171117T234803ZBolce Bu
022Excel VBA171010T203754ZTaylor R
014Add++171119T173613Zcaird co
042Lua171117T224123ZMCAdvent
008Aceto171116T203224Zqqq
012QBIC171014T093030Zsteenber
1215Batch171010T051154ZEphellon
231PHP171012T160836ZTitus
105Batch171011T221930ZSlapparo
055C# .NET171010T082304ZKevin Cr
031PowerShell171011T142913Zcolsw
018Bash + GNU utilities171011T004646ZDigital
054Pyth171010T214046Zchromati
058R171010T200420ZGiuseppe
037Swift 4171010T194353ZMr. Xcod
048bash171010T081037ZNahuel F
034Tcl171010T193800Zsergiol
054SAS171010T193615ZJ_Lard
064LISP171010T082649ZAesthete
025Python 2171010T181507ZJonathan
nan171010T165431ZBrad Gil
023Haskell171010T045946ZWheat Wi
003Jelly171010T025415ZJungHwan
049C gcc171010T080211ZLeaky Nu
007J171010T074925Zcole
087Batch171010T074817ZNeil
009Alice171010T074811ZMartin E
031MATLAB/Octave171010T073728ZTom Carp
002Japt171010T072541ZShaggy
006Recursiva171010T071431Z0xffcour
028JavaScript SpiderMonkey171010T022400ZEphellon
013LOGO171010T064611Zuser2027
006Husk171010T061945ZLaikoni
6018C# .NET Core171010T062116ZIan H.
044CasioBasic fxCP400171010T061321Znumberma
028Python 3171010T032822ZLyricLy
066Octave171010T060123ZMichthan
00205AB1E171010T042725ZMr. Xcod
004Pyth171010T042008ZMr. Xcod
007Ly171010T035207ZLyricLy
008cQuents 0171010T034512ZStephen
019Mathematica171010T023627ZJungHwan
012ARBLE171010T022231ZATaco
nanPerl 5171010T022854ZXcali
006RProgN 2171010T022119ZATaco

TI-BASIC (TI-84 Plus CE Python), 40 bytes

Input N
int(log(N
Nsum(seq(₁₀^(E),E,Ans,0,-1)int(10fPart(N₁₀^(seq(-X-1,X,0,Ans

AWK, 38 bytes

{for(;i++<split($0,a,X);)x=a[i]x}$0*=x

Attempt This Online!

SNOBOL4 (CSNOBOL4), 36 bytes

	OUTPUT =(I =INPUT) * REVERSE(I)
END

Try it online!

GolfScript, 7 bytes

.`-1%~*

Try it online!

Link includes test cases

Explanation

code    # explanation                             | stack
.`-1%~* # function which takes an input integer n | n
.       # duplicate n                             | n n
 `      # stringify                               | n str(n)
  -1%   # reverse                                 | n reverse(str(n))
     ~  # eval                                    | n reverse(n)
      * # multiply                                | n*reverse(n)

J-uby, 11 bytes

:*%(S|:~|Z)

Attempt This Online!

Explanation

:* % (S | :~ | Z)

      S | :~ | Z   # Convert input to string, reverse, then convert to int
:* % (          )  # Multiply by input

```

Pip, 4 bytes

a*Ra

Try It Online!

Leaf Lang, 41 bytes

Note: The interpreter does not have a stable release. If I introduce a breaking change I will update this post.

import"string.lf"argv:o o reverse o*print

Explained:

import "string.lf" - import stdlib's string.lf
argv               - push all of argv onto stack
:o                 - set o to top value from stack (pops top)
o                  - push o to top of stack
reverse            - reverse the string
o                  - push o to top of stack
*                  - leaf lang will implicitly convert strings to numbers when applicable
print              - print top value of stack with no newline

Ungolfed:

import "string.lf"
argv : num
num reverse num * 
print

CellTail, 89 bytes

1,_,_:1,N,N;N,(a,0,c),_:N,a*c,1;N,(a,b,c),_:N,(a,b/10,c*10+b%10),1;N,a&N..,N:N,(a,a,0),1;

Try the demo

CellTail has no way to turn a number into a string so we have to use modulus and integer division. Uses the cell to the right to provide recursion resistance.

Julia, 28 bytes

~n=parse(Int,reverse("$n"))n

Attempt This Online!

Prolog (SWI), 47 bytes

N-O:-name(N,C),reverse(R,C),name(I,R),O is I*N.

Try it online!

-16 thanks to Jo King

Fig, \$2\log_{256}(96)\approx\$ 1.646 bytes

*$

See the README to see how to run this

*$ # Full program
*  # Multiply
 $ # The reversed number
   # By the implicit input

Julia, 33 32 bytes

~n=foldl((x,y)->10x+y,digits(n))n

a^b=10a+b
~n=foldl(^,digits(n))n

Attempt This Online!

CJam, 8 bytes

l_W%i\i*

Try it online!

brev, 28 bytes

(fn(*((as-list reverse)x)x))

Crashes on negative

MathGolf, 2 bytes

x*

Try it online.

Explanation:

x   # Reverse the (implicit) input-integer
 *  # Multiply it by the (implicit) input-integer
    # (after which the entire stack is output implicitly as result)

Desmos, 97 bytes,

f=\left\{x>0:floor(log(x))+1,0\right\}
g(x)=x∑_{n=0}^f10^{f-n}floor(mod(\frac{x}{10^{n-1}},10))

Try it on Desmos.

Not sure if this is legal as a Desmos answer, uses the fact that variables can be defined in terms of x, but functions of x can use those variables as functions? I'm not sure what actually is happening, but it seems to be... working. If I'm not allowed to use that, change f= to f(x)= for +3 bytes

Only works for nonnegative integers, which I think is fine since OP doesn't include any test cases for them, and they're not well defined for this problem (what is -1 backwards? 1-? That's not a number IMO). If I'm allowed to assume positive integers, the first line can become

f=floor(log(x))+1

for -21 bytes. Very nice, but the challenge says "integers", so it's iffy.

In general though, I know this is further golfable but I tried some of the Desmos tips and I must be doing something wrong because they weren't working. I'll come back and golf this eventually.

Code breakdown:

f=\left\{x>0:floor(log(x))+1,0\right\} definition of... function(?) f
f=                                     define f as
         x>0:                          if x is positive
             floor(log(x))+1             length(x)
                            ,0         else 0
                                       i dont remember why but this works to make g(0)=0

g(x)=x∑_{n=0}^f10^{f-n}floor(mod(\frac{x}{10^{n-1}},10)) definition of main function
g(x)=                                                    define g(x) as
     x                                                   x times
      ∑                                                  the sum of
       _{n=0}^f                                          for each n from 0 to f(x)
               10^{f-n}                                    10^(f-n) times
                       floor(mod(\frac{x}{10^{n-1}},10))   the nth digit from the right of x
                                                         essentially: sum of
                                                           (nth digit of x)
                                                           multiplied by
                                                           (place value of 
                                                           (length(x)-n)th digit of x
                                                         aka: reverse(x)

JavaScript, 72 bytes

Doesn't use strings. At all.

-10 by steffan

n=>(a=[],r=n=>(n>9&&r(n/10|0),a=[n%10,...a]))(n).reduce((a,v)=>a*10+v)*n

Vyxal, 2 bytes

Ṙ*

Try it online, or verify all test cases.

Burlesque, 5 bytes

J<-|*

Try it online!

J  # Duplicate
<- # Reverse string
|* # string-to-val & multiply

Keg, 3 bytes

:⑶*

Try it online!

A port of the 05AB1E answer but longer.

Pepe, 61 bytes

REeErEEEEErREEEeEerRREEEEEEEREEEEeEeerRREEEEEeEErRREEEEeEReEE

Try it online!

Runic Enchantments, 11 10 bytes

i:0qr͍n*@

Try it online!

Takes input, duplicates it, coerces one copy to a string, reverses it, coerces it back to a numerical value, multiplies, and outputs the result.

0q performs the coercion to a string by concatenating a zero onto the end. There is no explicit ToString() operator, so this is the shortest method in this specific case where the 0 swapped to the beginning doesn't alter the resulting numerical value. Thanks to ASCII-only for this -1 byte.

Ohm v2, 2 bytes

œΠ

Try it online!

Explanation:

œΠ   Main wire, arguments: n

œ    Pushes [n, n.reverse]
 Π   Multiplies that array together
     Implicit output

><>, 33 bytes

:&v>&*nr
a,>:a(?^:a%:@-
2(?va*+>l

Try it online!

APL(NARS), 8 char, 16 bytes

{⍵×⍎⌽⍕⍵}

test:

  f←{⍵×⍎⌽⍕⍵}
  f 23
736
  23×32
736
  f 11
121

Java 8, 52 bytes

n->new Long(new StringBuilder(n+"").reverse()+"")*n;

Try it online
This will give every linter/IDE/compiler a stroke, but hey, it works

APL (Dyalog Unicode), 9 5 bytes

⍎×⍎∘⌽

Try it online!

Tacit prefix function. Takes input as a string of digits.

Thanks to Adám for 4 bytes.

How it works:

⍎×⍎∘⌽ ⍝ Anonymous, tacit function.
    ⌽ ⍝ Reverse the input
  ⍎∘  ⍝ Convert to number
 ×    ⍝ and multiply
⍎     ⍝ by input converted to number

Gol><>, 21 bytes

I:WaSD$|r}l3-Fa*+|+*h

Try it online!

An example > A million words

I :D WaSD$D| Dr}l3-D Fa*+D| D+*h
^659
   [659 659]
          [659 9 65]
          [659 9 5 6]
          [659 9 5 6 0]
             [659 9 5 6 0]
                   [659 0 6 5 9 2] <- 2 = operations to do
                         [659 0 6 95]
                         [659 0 956]
                            [659 0 956]

Alternate

I:WaSD$|~r}l2-Fa*+|*h
I:&WaSD$|~rlMFa*+|&*h

Java 8, 50 bytes

n->n*new Long(new StringBuffer(n+"").reverse()+"")

Try it here.

Pretty straightforward.


Arithmetic approach would be slightly longer (55 bytes):

n->{int i=n,j=0;for(;i>0;i/=10)j=j*10+i%10;return j*n;}

Try it here.

Explanation can be found in my C# .NET port.

Ruby, 25 24 bytes

->n{n*eval(n.digits*'')}

Try It Online!.

Integer#digits returns a list of reversed digits, so further reversing is not necessary.

Thanks to @benj2240 for golfing a byte!

MATL, 5 bytes

VPUG*

Try it online!

Explanation: V converts to string, P flips, U converts back to numeric, G copies the original input again, and * multiplies them together.

Pyt, 3 bytes

Đ₫*

Try it online!

Đ    Duplicate
 ₫   reverse digits
  *  duh
     implicit output

Jelly, 4 bytes

DUV×

Try it online!

REXX, 22 bytes

arg n
say n*reverse(n)

Implicit, 5 bytes

:ì\ì*

Try it online!

        « implicit integer input   »;
:       « duplicate                »;
 ì      « convert to string        »;
  \     « reverse                  »;
   ì    « back to int              »;
    *   « multiply                 »;
        « implicit integer output  »;

><>, 41 39 Bytes

:&>:a%:}-\
/~\?)0:,a/
>l1-?\&*n;
\ +*a/

How it works:

:&

Assume input has been pushed to the stack (https://codegolf.meta.stackexchange.com/a/8493/76025). Duplicate it and store a copy in the register.

   >:a%:}-\
   \?)0:,a/

Converts this to its individual digits, leaving them on the stack.

/~
>l1-?\
\ +*a/

The top value will always be a zero due to the number-to-digit conversion process; drop it from the stack. Now, while the length is >1, multiply the first item by ten and add it to the item below it. This results in the number reversed.

      &*n;

Multiply the original number by the reverse, print the answer, and stop.

Excel VBA, 27 22 Bytes

Anonymous VBE Immediate window function that takes input from [A1] and outputs to the VBE immediate window

?[A1]*StrReverse([A1])

Add++, 14 bytes

D,f,@,EDE@EdA*

Try it online!

How it works

With example input of 12

D,f,@,   - Create a monadic function, f
      ED - To digits;   STACK = [[1 2]]
      E@ - Reverse;     STACK = [[2 1]]
      Ed - From digits; STACK = [21]
      A  - Argument;    STACK = [21 12]
      *  - Product;     STACK = [252]

Lua, 42 bytes

function f(n)print(n*(""..n):reverse())end

Try it online!

Aceto, 8 bytes

rd~isi*p
r  reads input
d  duplicates it
~  reverses the top value
i  convertes it to an integer
s  swaps the two top values
i  convertes the other value to an integer
*  multiplies the top two
p  prints the result

Try it online!

QBIC, 12 bytes

_F!:$|?a*!A!

Explanation

   :    Get the input number from the cmd line and assign to 'a'
  ! $     Cast it to string
_F   |    and flip[ that, assigning it into A$
?a*     PRINT 'a' times
   !A!    A$ cast back to int

Batch, 150 125 121 bytes (+ 5 bytes? cmd/q)

set l=%1
set n=0
set r=
:L
call set t=%%l:~%n%,1%%%
set/an+=1
if [%t%] neq [] set r=%t%%r%&goto L
set/ar=%r%*%l%
echo %r%

Saved 25 bytes thanks to user202729!

Saved 4 bytes thanks to Matheus Avellar!

PHP, 23+1 bytes

<?=$argn*strrev($argn);

Save to file and run as pipe with -nF.

Batch, 105 bytes

@set c=
@set a=%1
:J
@set c=%c%%a:~-1%
@set a=%a:~0,-1%
@if NOT "%a%" == "" goto J
@set/ac=%1*%c%

The reverse is performed in a loop which appends the last character @set c=%c%%a:~-1% from the input to c, and then removes the last character from the input string @set a=%a:~0,-1% - rinse and repeat until there are no characters left on the input string. A quick multiplication @set/ac=%1*%c% and done.

C# .NET, 55 bytes

n=>{int i=n,j=0;for(;i>0;i/=10)j=j*10+i%10;return n*j;}

Explanation:

Try it here.

n=>{           // Method with integer as both parameter and return-type
  int i=n,     //  Integer `i` (starting at the input)
      j=0;     //  Integer `j` (starting at 0)
  for(;i>0;    //  Loop as long as `i` is not 0
      i/=10)   //    After every iteration: Remove the last digit of `i`
    j=j*10     //   Add a trailing zero to `j`,
      +i%10;   //   and then sum this new `j` with the last digit of `i`
               //  End of loop (implicit / single-line body)
  return n*j;  //  Return the input multiplied with `j`
}              // End of method

PowerShell, 31 Bytes

param($a)$a*-join("$a"[-1..-9])

Powershell is more than happy to multiply a number by a valid numerical string which is nice.

Bash + GNU utilities, 18

bc<<<$1*`rev<<<$1`

Try it online.

Pyth, 5 4 bytes

*v_`

Try it online!

Explanation:

*v_`QQ : accepts a number as input
   `Q  : represent input as string
  _    : reverses string
 v     : evaluates the string as a number again
*    Q : multiply by the input
       : implicit output
(remove Q's as Pyth adds them for you)

R, 58 bytes

cat((n=scan())*sum(n%/%10^(d=1:nchar(n)-1)%%10*10^rev(d)))

Try it online!

reads from stdin, writes to stdout. n%/%10^(d=1:nchar(n)-1)%%10 is how we get the digits, and reversing them is as simple as taking that vector, multiplying by 10^rev(d), and summing.

R + stringi, 47 bytes

cat(strtoi(stringi::stri_reverse(n<-scan()))*n)

Try it online!

stringi (not stringr) has a stri_reverse command.

Swift 4, 37 bytes

{$0*Int(String("\($0)".reversed()))!}

Try it here!

Just my mandatory gigantic Swift entry.

bash, 52 48 bytes

for((i=n=$1;r=r*10+i%10*n,i/=10;));{ :;};echo $r

Tcl, 34 bytes

proc F n {expr $n*[string rev $n]}

Try it online!

SAS, 54 bytes

%macro f(n);%put%eval(&n*%sysfunc(reverse(&n)));%mend;

LISP, 91 64 bytes

(defun R (N)(defvar M (write-to-string N)) (parse-integer (reverse M))) (write (* x (R x)))

(defun R(N)(write(* N(parse-integer(reverse(write-to-string N))))))

Where x N is your integer you want to work with, of course.

I'm pretty new to programming, but I've found that trying these Code Golf problems has been nice practice. Is there something I'm missing that could help with this?

EDIT: Thanks to some tips from ceilingcat, I was able to shave off a few bytes. Old program preserved in strikethrough for reference.

Python 2, 25 bytes

lambda n:n*int(`n`[::-1])

Try it online!

Perl 6, 10 bytes

{$_*.flip}

Try it

Expanded

{       # bare block lambda with implicit parameter $_
  $_
  *
  .flip # implicit method call on $_
}

Haskell, 27 23 bytes

4 bytes saved thanks to Lynn and Laikoni

(*)=<<read.reverse.show

Try it online!

Jelly, 3 bytes

×ṚḌ

I'm new to Jelly, so please let me know if there is a way to do this in 1 or 2 bytes!

Try it online!

Explanation

×ṚḌ    (Input: 12)

 Ṛ     Reversed decimal digits (Stack: [2, 1])
×      Multiply by input       (Stack: [24, 12])
  Ḍ    Convert to decimal      (Stack: 252)
       Implicit print

C (gcc), 49 bytes

i,a;f(n){for(i=0,a=n;a>0;a/=10)i=i*10+a%10;n*=i;}

Try it online!

J, 7 bytes

*|.&.":

Try it online!

Couldn't think of a shorter way, though I feel like this is pretty elegant.

Explanation

*|.&.":
   &.":  Convert to string, apply next function, then undo conversion
 |.      Reverse
*        Multiply by input

Batch, 87 bytes

@set s=%1
@set r=
:l
@set/ar=r*10+s%%10,s/=10
@if %s% gtr 0 goto l
@cmd/cset/a%1*r

Need to take the arithmetic route here as string reversal fails for some numbers such as 80.

Alice, 9 bytes

//.*
oR@i

Try it online!

Explanation

/    Switch to Ordinal. Move SE.
R.   Reverse and duplicate an implicit empty string. Does nothing.
i    Read all input as a string.
.    Duplicate.
R    Reverse.
/    Switch to Cardinal. Move W.
*    Implicitly convert the two strings to integers and multiply them.
.    Duplicate the result. Irrelevant.
/    Switch to Ordinal. Move NW. Immediately bounces off the wall to move SW instead.
o    Implicitly convert the result back to a string and print it.
/    Switch to Cardinal. Move S.
R    Reverse the other copy of te result. Irrelevant.
/    Switch to Ordinal. Move NE. Immediately bounces off the wall to move SE instead.
@    Terminate the program.

MATLAB/Octave, 33 31 bytes

@(n)str2num(flip(int2str(n)))*n

Try it online!

Octave/MATLAB anonymous function. This is a pretty naïve approach - converts the integer to a string, flips the string, converts the result back to an integer and multiplies it by the original.


Japt, 2 bytes

Takes input as a string, outputs an integer.

*w

Try it

Recursiva, 6 bytes

*aI_Va

Try it online!

Explanation:

*aI_Va
*a      - multiply by a(input)
  I     - Integerify
   _    - Reverse   
    V   - Stringify 
     a  - a (Input)

JavaScript (SpiderMonkey), 45 35 33 28 bytes

n=>n*[...n].reverse().join``

Try it online!

LOGO, 13 bytes

[?*reverse ?]

Currently there is no TIO for Logo, but you can try it online at http://golf.shinh.org/check.rb . However that's UCBLogo where there is a feature that prints

Thank you for using Logo.
Have a nice day.

on program exit; if this is considered as a function invocation it does not count. (that is, the function does not prints the message)

Usage:

print invoke [?*reverse ?] 123

or

print apply [?*reverse ?] [123]

prints

39483

Husk, 6 bytes

S*(d↔d

Try it online!

Explanation

S*(    Multiply the input with the result of the following function applied to the input
     d convert number to list of digits 
    ↔  reverse list
   d   interpret list of digits as number

C# (.NET Core), 60 + 18 bytes

+18 bytes for using System.Linq;.

Reversing strings in C# is a pain.

n=>n*int.Parse(new string(n.ToString().Reverse().ToArray()))

Try it online!

Casio-Basic (fx-CP400), 44 bytes

ExpToStr n,a
StrInv a,a
Print n*strToExp(a)

There's no built-in for reversing an integer, but there is one for reversing a string.

ExpToStr n,a turns n into a string and stores it in a, then StrInv a,a overwrites a with the reversed version of itself. The last line turns a into a number, and prints n*a.

43 bytes for the code, +1 to input n into the parameters box.

Python 3, 35 28 bytes

lambda m:m*int(str(m)[::-1])

Try it online!

Saved 7 bytes by fixing a bug pointed out by Dennis.

Octave, 66 bytes

n=m=input('');j=0;while(m!=0) j=10*j+rem(m,10);m=fix(m/10);end
n*j

Since Octave doesn't have a function to reverse integers, I had to write one myself. That's what the while loop does. Any help will be much appreciated.

05AB1E, 2 bytes

R*

Try it online!

In 05AB1E, integers and strings are treated as equivalent types, so reversal (R) converts to string and reverses, whilst multiplication (*) treats the reverse and the input as integers.

Pyth, 4 bytes

*s_`

Try it online!

Ly, 7 bytes

nsSrJl*

Try it online!

cQuents 0, 8 bytes

#|1:A\rA

Try it online!

Explanation

#|1:      Output first term in sequence
    A\rA  Each term in the sequence equals:
           A * \reverse(A)

Mathematica, 19 bytes

# IntegerReverse@#&

Takes an integer input.

ARBLE, 12 bytes

Takes input as an int.

a*reverse(a)

Try it online!

Perl 5, 11 + 1 (-p) = 12 bytes

$_*=reverse

Try it online!

RProgN 2, 6 bytes

]Ø.in*

]Ø.in*
]       # Duplicate the input to the stack
 Ø.     # Append a blank string, stringifying the input.
   i    # Reverse it.
    n   # Cast to a number.
     *  # Multiply with the orignal input, implicitely output.

Try it online!