# Print a bunch of uninteresting numbers!

An uninteresting number (which I totally didn't make up only for this challenge) is created like this:

1. Take a positive integer N
2. Create a new number O by adding the digits of N at the end of N
3. The final uninteresting number is O*N

For example for N=12:

1. O = 1212
2. O*N = 1212 * 12
3. Final number is 14544

# Input

A positive integer N (N > 0) or your language's equivalent. You don't have to catch incorrect input.

# Output

The corresponding uninteresting number.

# Test cases

  1 -> 11
2 -> 44
3 -> 99
10 -> 10100
174 -> 30306276


# Scoring

Shortest Code in Bytes wins.

• There must be a relevant OEIS entry...
– MKII
Commented Jul 7, 2016 at 10:52
• @Seims It was a joke, based on the "uninsteresting" name
– MKII
Commented Jul 7, 2016 at 11:10
• @MKII my bad, i don't speak joke Commented Jul 7, 2016 at 11:13
• Is taking the number as a string argument bending the rules a bit too much? Commented Jul 7, 2016 at 11:39
• Go ahead, bend the rules! :P Commented Jul 7, 2016 at 11:44

## 05AB1E, 3 bytes

Ð«*


Explained

Ð    # triplicate input
«   # conactenate
*  # multiply


Try it online

• Ahh, nice! Ninja'd me by seconds :p. Commented Jul 7, 2016 at 10:44
• @Adnan Hehe. Revenge for that time you did it to me :P Commented Jul 7, 2016 at 10:46
• 3 operations, 3 bytes, I don't think you could make it any shorter than that. Commented Jul 7, 2016 at 11:20
• @busukxuan Yep. Concatenate automatically converts the number to str and * interprets the string as a number. Very useful :) Commented Jul 7, 2016 at 11:50
• @busukxuan Yeah, a combination of Pyth and 05AB1E could have done it in 2 bytes :) Commented Jul 7, 2016 at 12:01

## JavaScript (ES6), 10 bytes

_=>(_+_)*_


Needs to be called with the argument as a String, not a Number.

### Usage:

(_=>(_+_)*_)('3')
99


-3 bytes thanks to @Quill's suggestion.

• If you can pass the parameter as a string you can cut two bytes off this solution: _=>(_+_)*+_ Commented Jul 7, 2016 at 11:34
• How exactly does this work? If I understand correctly, are you using _ as an arbitrary character for a variable? (PS - (_+_) totally looks like a butt) Commented Jul 7, 2016 at 13:11
• @charredgrass $ would also work – cat Commented Jul 7, 2016 at 13:13 • type casting abuse eleven Commented Jul 7, 2016 at 15:41 • Out of interest, the best I could do purely mathematically was 30 bytes in ES7 n=>(1+10**-~Math.log10(n))*n*n (sadly -~ have higher precedence than **) or 31 in ES6 n=>-~1e${-~Math.log10(n)}*n*n. Even recursion took me 32 bytes: f=(n,m=1)=>n<m?-~m*n*n:f(n,m*10)
– Neil
Commented Jul 7, 2016 at 18:48

# Java 8, 29 26 25 21 Bytes

God bless lambda

c->new Long(c+""+c)*c


c->Long.decode(c+""+c)*c;

• You gotta love Java; even with lambdas of Java 8 and one of the shortest Java answers ever here on codegolf, it's still outgolfed by all other current answers. xD Commented Jul 7, 2016 at 11:15
• java is bae, lambda is bae Commented Jul 7, 2016 at 11:31
• @KevinCruijssen i still have a hope, one day java will win codegolf contest Commented Jul 7, 2016 at 11:51
• After your edit you outgolfed @MartinEnder with his Retina answer by 1 byte! o.Ô Commented Jul 7, 2016 at 12:39
• @KevinCruijssen but still not enough to win or at least beat python:( Commented Jul 7, 2016 at 13:08

## vim, 11

C<C-r>=<C-r>"<C-r>"*<C-r>"<cr>


crcrcrcrcr...

C       change (delete and enter insert mode) until the end of the line
<C-r>=  insert an expression via the special "expression register"
<C-r>"  insert the contents of the default register (what we just C'd)
<C-r>"  ... again
*       multiplied by
<C-r>"  the input (again)
<cr>    insert the result of this expression

• 11 what? bytes? Commented Jul 7, 2016 at 22:35
• @Insane Bytes if you call it from the command line, keystrokes if you do it directly from vim. I usually omit the unit from my vim answers because it can be either one. Commented Jul 7, 2016 at 22:44
• v.tryitonline.net/#code=QxI9EiISIioSIgo&input=MTI To bad <C-r> is unprintable. Commented Jul 9, 2016 at 7:56
• Is <C-r> a carriage return? Commented Jul 11, 2016 at 13:58
• @CaptainMan No, <C-r> is control plus r. Carriage return is <cr>. Commented Jul 11, 2016 at 14:15

# Pyth, 5 4 bytes

*s+


Explanation:

    Q    input
representation, basically str(Q)
+  Q   add Q to its own string form
s       parse int
*     Q  multiply by input
print


# Emacs, 17 bytes

(*SPACEC-SPACEC-EM-YSPACEC-YC-Y)C-J

### Explanation

• (*SPACE adds (*  at point (before the number);
• C-SPACEC-EM-Y Select and copy the number;
• SPACE adds a space character at point (after the number);
• C-YC-Y pastes two times the number at point;
• ) adds ) at the end;
• C-J interprets the line as a LISP expression and prints its result.

### Exemple

Cursor represented by a pipe (|)

• |174
• (*SPACE (* |174
• C-SPACEC-EM-Y (* 174|
• SPACE (* 174 |
• C-YC-Y (* 174 174174|
• ) (* 174 174174)|
• C-J

### Result

(* 174 174174)
30306276|

• Hi, and welcome to PPCG! Nice first post! Commented Jul 7, 2016 at 14:54

# Python 2.7, 21 bytes:

lambda f:int(f*2)*f


Well, this has to be the shortest Python answer I have ever written in the shortest amount of time ever. It's an anonymous lambda function that can be executed by naming it anything you want and then calling it like a normal function wrapped in print(). For instance, if your input is 12, and the function was named H, this this would be called like print(H(12)).

Try It Online! (Ideone)

Note that this only works for values up and equal to 9223372036854775807 since any higher value and repr() puts a L at the end of the integer. Therefore, for values greater than 9223372036854775807, this 24 byte version would be the one that works:

lambda f:int(str(f)*2)*f


Try This Online! (Ideone)

• I still find Phytons String operations magical... Commented Jul 7, 2016 at 10:34
• @Seims in what way? Commented Jul 7, 2016 at 11:36
• String multiplication and addition. Haven't seen that often. Commented Jul 7, 2016 at 11:37
• @Seims I guess you mostly deal with static languages then? Commented Jul 7, 2016 at 11:42
• It's sad that a third of this answer is Python's verbose lambda syntax Commented Feb 22, 2017 at 23:59

# C#, 19 23 bytes

n=>int.Parse(""+n+n)*n;


# Without strings, 47 bytes

n=>{int i=1;while(i<=n)i*=10;return(i+1)*n*n;};

• This is a snippet, not a full program or function. It would be valid with e.g. (n)=>{int.Parse(""+n+n)*n}2
– cat
Commented Jul 7, 2016 at 13:12
• @cat better? do I need the trailing ;? Commented Jul 7, 2016 at 13:22
• I don't know. See also Defaults for Code Golf and Tips for golfing in C#
– cat
Commented Jul 7, 2016 at 16:12

## Jelly, 4 Bytes

;DḌ×


Try it online

## Explanation

;DḌ×    Main link. argument : N

D      Decimal; Yield the digits of N
;       Concatenate N and its digits
Ḍ     Convert to integer; We get O
×    Multiply O and N

• It's a really happy winking face with a goatee! ;DDx
– cat
Commented Jul 7, 2016 at 16:11
• In which encoding does Ḍ take only 1 byte? Usually we use UTF-8, in which it takes 3 (and the × takes 2, but it is 1 byte in e.g. ISO8859-1).
– o11c
Commented Jul 9, 2016 at 1:49
• @o11c Jelly uses its own custom code page where these characters are one byte each. Commented Jul 12, 2016 at 17:34

# J, 7 bytes

*,~&.":


## Explanation

*,~&.":  Input: n
":  Format n as a string
,~&.    Reflect and join the string to make "nn"
and parse the string to get a number
*        Multiply that number by n

• +1. I couldn't even think that Under is working properly with string concatenation. What a great discovery for me! Thank you. Commented Jul 15, 2016 at 6:04
• Sadly, I think this should be in parenthesis, since it's a hook that is not working if typed directly * ,~ &.": n, and can't be used in formation of other verbs either. Commented Jul 15, 2016 at 6:06
• @dahnoak Here at PPCG, we only have to specify what is needed for a function, and so the above is all that is necessary to create a function in J. Then to invoke it using some input as an argument, it will either be in parentheses or stored in a variable. Commented Jul 15, 2016 at 6:11
• Ah, I got this, ty. Commented Jul 15, 2016 at 9:50

# C, 7068545352 44

f(n){return(pow(10,(int)log10(n)+1)*n+n)*n;}


Previous version (48 bytes, no math functions), saved 16 bytes thanks to @LeakyNun, 1 byte thanks to @FryAmTheEggman, 4 bytes thanks to @TobySpeight:

f(n,d,i){for(i=d=n;d;d/=10)i*=10;return(i+n)*n;}


Call f() with one argument, the number, and it returns the corresponding uninteresting number.

## Test program

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
while (*++argv) {
int n = atoi(*argv);
printf("%d -> %d\n", n, f(n));
}
return 0;
}


$./84712 1 2 3 4 10 174 1 -> 11 2 -> 44 3 -> 99 4 -> 176 10 -> 10100 174 -> 30306276  Try it online! • f(n){int b=1;while(a)b*=10,a/=10;return(n+n*b)*n;} Commented Jul 7, 2016 at 13:08 • This shouldn't work properly without including math.h, but you get away with it in GCC, where log10() and pow() are built-in, and the compiler merely warns about "incompatible implicit declaration of built-in function" rather than assuming (as it should) that they both return int. Commented Jul 7, 2016 at 14:16 • @Leaky - you didn't put anything into a... Commented Jul 7, 2016 at 14:16 • It's nice to see another answer that stays entirely within the arithmetic world (not doing string concatenation). :-) Commented Jul 7, 2016 at 14:31 • @Toby - String concatenation in C is incompatible with golfing. ;-) Commented Jul 7, 2016 at 14:32 # Dyalog APL, 7 bytes ⊢×#⍎⍕,⍕  ⍕ string representation ⍕, prepend string representation #⍎ make into number (in root namespace) ⊢× multiply by original number • Those wrecked TIE fighters are funny! Commented Jul 7, 2016 at 11:13 • @LuisMendo dyalog.com/blog/2015/12/apl-puns – Adám Commented Jul 7, 2016 at 12:09 • The fork awakens :-D Commented Jul 7, 2016 at 12:28 • I'm pretty sure those aren't bytes in any encoding, since they're not letterlike or very common. – o11c Commented Jul 9, 2016 at 1:51 • @o11c Did you check out the preemptive link for the word "bytes", viz. meta.codegolf.stackexchange.com/a/9429/43319. – Adám Commented Jul 10, 2016 at 1:19 ## Retina, 27 20 bytes ^$_$*:$_
:
$_$*:
:


Gets a bit slow for large inputs, because before the last the stage the result is represented in unary.

Try it online! (The first line enables a linefeed-separated test suite.)

### Explanation

I'll use 2 as an example input (because the unary representations get a bit unwieldy for larger inputs).

Stage 1: Substitution

^

# Brachylog, 7 bytes

:?c:?*.


### Explanation

:?c      Concatenate Input to itself
:?*.  Output is that concatenation times Input


# Python, 42 bytes

Pure arithmetic approach, without strings!

f=lambda n,m=1:m<=n and f(n,m*10)or-~m*n*n


Ideone it!

# Matlab / Octave, 20 bytes

@(x)eval([x x 42 x])


This is an anonymous function that takes the input as a string.

Example use:

>> f = @(x)eval([x x 42 x])
f =
@(x)eval([x,x,42,x])
>> f('12')
ans =
14544


### Explanation

The code builds a string by concatenating the input string twice, then the character * (that has ASCII code 42), then the string again. The concatenated string is then evaluated.

• What does 42 mean? Commented Jul 7, 2016 at 14:45
• @LeakyNun It's the Answer to the Ultimate Question of Life, the Universe, and Everything". Also, it happens to be the ASCII code for * Commented Jul 7, 2016 at 14:51
• Ah. I was searching for something like the 42th function. Commented Jul 7, 2016 at 14:54
• The code simply builds a string by concatenating the input string twice, then *, then the string again. The concatenated string is then evaluated. I'll edit that into the answer Commented Jul 7, 2016 at 14:58

## Lua, 20 Bytes

Takes in a command-line argument, and outputs via STDOUT

a=...print((a..a)*a)


And ungolfed as @LeakyNun asked in the comment :)

a=...       -- alias for the first argument
print(
(a..a) -- concatenate a with itself, equivalent to a:rep(2)
*a)    -- multiply the resulting number by a

• That can be a nice demonstration of type coercion... if you add the explanation in. Commented Jul 18, 2016 at 8:22

# MATL, 6 bytes

tVthU*


Try it online!

tV     % Input number implicitly. Duplicate and convert to string
th     % Duplicate and concatenate the two equal strings
U      % Convert to number
*      % Multiply


## zsh, 13 bytes

<<<$[$1$1*$1]


Takes input as a command line argument, outputs to STDOUT.

This only works in zsh, but here's 15 bytes in Bash using echo instead of <<<:

echo $[$1$1*$1]


## Perl, 11 bytes

$_*=$_ x2


+ the p and l flags.

(run with perl -ple '$_*=$_ x2')

-2 bytes thanks to pipe.

• Save two bytes: $_*=$_ x2
– pipe
Commented Jul 7, 2016 at 16:56
• I don't think you need -l Commented Jul 7, 2016 at 17:56
• @BradGilbertb2gills Yes I need it because without it, $_ x2 will produce ...\n...\n which when converted as a number by perl ends at the first \n – Dada Commented Jul 7, 2016 at 18:04 • I was testing it with both Perl 5 and 6, and didn't notice that I forgot to remove the 6. Commented Jul 7, 2016 at 18:08 ## Excel VBA, 35 Bytes Sub called with number, msgbox returns answer Sub B(a) MsgBox (a & a) * a End Sub  Alternative Excel VBA, 42 Bytes Number given in formula, returns answer. Function B(a) B = (a & a) * a End Function  • Think about a MsgBox and a Sub. It will save you 13 Byte, if I count correctly Commented Jul 7, 2016 at 18:38 • I would need some form of input box to get the value, no? – tjb1 Commented Jul 7, 2016 at 18:39 • Try Sub B(a) MsgBox (a & a) * a End Sub Commented Jul 7, 2016 at 18:42 • That requires another sub to pass the value, I'm not sure that's allowed in golf. – tjb1 Commented Jul 7, 2016 at 18:44 • The Function must be called too ;) Commented Jul 7, 2016 at 18:47 ## Pyke, 5 4 bytes +b*  Try it here!  - str(input) + - ^+input (convert to string implicitly) b - int(^) * - ^*input  Also 5 bytes with string inputs +bRb* +]mbB  # PHP, 25 24 bytes Short opening tags are useful for surprisingly few golfing challenges, luckily this is one of them. Unfortunately operator precedence is the opposite of the order you need to do them in so lots of brackets are needed. <?=($a=$argv[1])*"$a$a";  edit: I realised that seeing as how I'm using brackets anyway I can effectively skip the concatenation operator by changing the written order of the operations around. # dc, 11 10 bytes ddZAr^1+**  I knew that eventually I would find a use for the Z command! Operation is fairly simple - count the digits, take 10 raised to that power and add one. This gives a multiplier that concatenates the number with itself. Then just multiply. I/O uses the stack, as usual for dc. ## Full program This is what I used for the tests: #!/usr/bin/dc ? ddZAr^1+** p  The two extra commands give us pipeline I/O. ## Tests $ for i in 1 2 3 10 174; do printf '%d -> ' $i; ./84712.dc <<<$i; done
1 -> 11
2 -> 44
3 -> 99
10 -> 10100
174 -> 30306276


Thanks are due to Sir Biden XVII (1 byte).

• You can substitute A for 10 to save a byte. Well done!
– juh
Commented Jul 7, 2016 at 20:38

# R, 28 27 bytes

Edit: -1 byte thanks to @Dominic van Essen.

(10^nchar(z<-scan())*z+z)*z


Try it online!

Shorter than bouncyball's solution with different approach.

Explanation

z=scan() gets input
10^nchar(z))*z+z is concatenation of the two copies of the number
*z at the end to get the result.

• 27 bytes... but it took 6 years to save the last byte! Commented Apr 9, 2022 at 8:59
• @DominicvanEssen, thanks, that's some archaeological work! (it was my second R answer on this site...) Actually inlining the scan does the job, so I'll stick to the old formula. Commented Apr 9, 2022 at 12:45
• Sometimes one of these old questions comes to the top of the 'Home' page, and I give it a go, and only afterwards check whether there's already a similar answer... Commented Apr 9, 2022 at 15:20

# Mumps, 11 bytes

R I W I_I*I


This is one of those rare golf challenges where the idiosyncrasies of Mumps can come in very handy. First, all variables are strings, and all math equations are strictly evaluated left-to-right (as in: not PEMDAS), so 1+2*4=12 in Mumps instead of =9 the way PEMDAS would. So, (barely) ungolfed:

R I ;     Read from stdin to variable I
W I_I*I ; Write out I concatenated with I, then multiplied by I.


Word of caution - because the flavour of Mumps that I'm using (InterSystems Ensemble) does not echo the carriage return for stdin, the input and output number will appear concatenated. To rectify that / increase readability, you'd need to add two bytes and add a manual CR/LF, thusly:

R I W !,I_I*I


However, as I didn't see that requirement in the rules of the challenge, I'm pretty sure that I'm good with the shorter code. If I'm mistaken, please feel free to LART me and I'll modify my answer. :-)

# PowerShell, 25, 18 bytes

Thank you TessellatingHeckler for reminding me how much PS loves the pipeline.

New 18 bytes:

process{$_*"$_$_"}  Old 25 bytes: param($a);[int]"$a$a"*$a  Explanation: # new process{$_*"$_$_"}
process{         } # runs code block once for each passed item
$_* # multiple the first parameter "$_$_" # concatenate as a string for ease # in this case, the order does the typecasting for us # old param($a);[int]"$a$a"*$a param($a)                 # assigns the first passed parameter to variable $a ; # line terminator [int] # type cast string "$a$a" to int32 "$a$a" # convert$a$a to string for easy concatenation *$a  # multiply by $a  Testing (save as boring.ps1): # new 12 | .\boring.ps1 14544 174 | .\boring.ps1 30306276 # old .\boring.ps1 12 14544 .\boring.ps1 174 30306276  Definitely not the winning answer, but fun regardless! • If you put the variables the other way around, int * string will implicitly cast the string to an int, and you can save 5 bytes of casting. process{$_*"$_$_"} is 18 bytes, and takes input from "stdin" (i.e. the pipeline), e.g. 174|script.ps1 Commented Jul 7, 2016 at 19:51
• Hmmm... Interesting point. I can also switch them using my same structure and achieve the same result: param($a);$a*"$a$a" Commented Jul 8, 2016 at 14:59
• Err, I take that back, mine is one byte longer! Commented Jul 8, 2016 at 15:00
• @TessellatingHeckler Careful with that answer, since PowerShell's REPL environment doesn't qualify for the program or function default. Something like param($n)$n*"$n$n" (what Darth had, without the ;) is the same length and isn't a REPL. Commented Jul 12, 2016 at 19:18
• @TimmyD why doesn't a test.ps1 file which reads from the pipeline count? Does a bash shell script reading from stdin not count either? Commented Jul 12, 2016 at 19:21