# 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 Jul 7 '16 at 10:52
• @Seims It was a joke, based on the "uninsteresting" name – MKII Jul 7 '16 at 11:10
• @MKII my bad, i don't speak joke – Seims Jul 7 '16 at 11:13
• Is taking the number as a string argument bending the rules a bit too much? – Dom Hastings Jul 7 '16 at 11:39
• Go ahead, bend the rules! :P – Seims Jul 7 '16 at 11:44

## 05AB1E, 3 bytes

Ð«*


Explained

Ð    # triplicate input
«   # conactenate
*  # multiply


Try it online

• Ahh, nice! Ninja'd me by seconds :p. – Adnan Jul 7 '16 at 10:44
• @Adnan Hehe. Revenge for that time you did it to me :P – Emigna Jul 7 '16 at 10:46
• 3 operations, 3 bytes, I don't think you could make it any shorter than that. – Lasse Meyer Jul 7 '16 at 11:20
• @busukxuan Yep. Concatenate automatically converts the number to str and * interprets the string as a number. Very useful :) – Emigna Jul 7 '16 at 11:50
• @busukxuan Yeah, a combination of Pyth and 05AB1E could have done it in 2 bytes :) – Emigna Jul 7 '16 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: _=>(_+_)*+_ – Quill Jul 7 '16 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) – charredgrass Jul 7 '16 at 13:11
• @charredgrass $ would also work – cat Jul 7 '16 at 13:13 • type casting abuse eleven – Downgoat Jul 7 '16 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 Jul 7 '16 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 – Kevin Cruijssen Jul 7 '16 at 11:15
• java is bae, lambda is bae – Seims Jul 7 '16 at 11:31
• @KevinCruijssen i still have a hope, one day java will win codegolf contest – user902383 Jul 7 '16 at 11:51
• After your edit you outgolfed @MartinEnder with his Retina answer by 1 byte! o.Ô – Kevin Cruijssen Jul 7 '16 at 12:39
• @KevinCruijssen but still not enough to win or at least beat python:( – user902383 Jul 7 '16 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? – Insane Jul 7 '16 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. – Doorknob Jul 7 '16 at 22:44
• v.tryitonline.net/#code=QxI9EiISIioSIgo&input=MTI To bad <C-r> is unprintable. – DJMcMayhem Jul 9 '16 at 7:56
• Is <C-r> a carriage return? – Captain Man Jul 11 '16 at 13:58
• @CaptainMan No, <C-r> is control plus r. Carriage return is <cr>. – Doorknob Jul 11 '16 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! – Rɪᴋᴇʀ Jul 7 '16 at 14:54

# 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 Jul 7 '16 at 13:12
• @cat better? do I need the trailing ;? – weston Jul 7 '16 at 13:22
• I don't know. See also Defaults for Code Golf and Tips for golfing in C# – cat Jul 7 '16 at 16:12

# 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... – Seims Jul 7 '16 at 10:34
• @Seims in what way? – busukxuan Jul 7 '16 at 11:36
• String multiplication and addition. Haven't seen that often. – Seims Jul 7 '16 at 11:37
• @Seims I guess you mostly deal with static languages then? – busukxuan Jul 7 '16 at 11:42
• @busukxuan Call me a noob if you want :^) – Seims Jul 7 '16 at 11:44

## 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 Jul 7 '16 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 Jul 9 '16 at 1:49
• @o11c Jelly uses its own custom code page where these characters are one byte each. – a spaghetto Jul 12 '16 at 17:34

# 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;} – Leaky Nun Jul 7 '16 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. – Toby Speight Jul 7 '16 at 14:16 • @Leaky - you didn't put anything into a... – Toby Speight Jul 7 '16 at 14:16 • It's nice to see another answer that stays entirely within the arithmetic world (not doing string concatenation). :-) – Toby Speight Jul 7 '16 at 14:31 • @Toby - String concatenation in C is incompatible with golfing. ;-) – owacoder Jul 7 '16 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! – Luis Mendo Jul 7 '16 at 11:13 • @LuisMendo dyalog.com/blog/2015/12/apl-puns – Adám Jul 7 '16 at 12:09 • The fork awakens :-D – Luis Mendo Jul 7 '16 at 12:28 • I'm pretty sure those aren't bytes in any encoding, since they're not letterlike or very common. – o11c Jul 9 '16 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 Jul 10 '16 at 1:19 # 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. – Dan Oak Jul 15 '16 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. – Dan Oak Jul 15 '16 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. – miles Jul 15 '16 at 6:11 • Ah, I got this, ty. – Dan Oak Jul 15 '16 at 9:50 ## 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

^
$_$*: $_  By matching the beginning of the string with ^ we simply prepend some stuff. $_ refers to the input string itself and $*: means we insert that many colons. So we get: :: 22  Stage 2: Substitution :$_$*:  Now we match every : and again replace it with $_$*:. Of course, this time $_ doesn't evaluate to an integer (but to :: 22 in our example), but $* just looks for the first decimal in the string, so this evaluates to the input concatenated to itself (O in the challenge specification). We'll end up with N*O colons, followed by O: :::::::::::::::::::::::::::::::::::::::::::: 22  Stage 3: Match :  All that's left is counting the :s to convert from unary back to decimal, which is exactly what this stage does. • Ooh, so close to being as long as Java. Outgolfed it by just 2 bytes. +1 – R. Kap Jul 7 '16 at 11:21 • @R.Kap Actually, Java 8 outgolfed it after removing 3 bytes! o.Ô – Kevin Cruijssen Jul 7 '16 at 12:36 • Sorry, Java.... – Martin Ender Jul 7 '16 at 13:16 # CJam, 8 bytes ri__+i*  Try it online! r e# Read input i e# Convert to integer _ e# Duplicate  e# Convert to string _ e# Duplicate + e# Concatenate i e# Convert to integer * e# Multiply. Implicitly display  • I was about to suggest not converting to in then immediately back to string but the naive approach (i.e. having never used CJam before) is r__+i\i*, which is the same length. – Fund Monica's Lawsuit Jul 7 '16 at 11:34 • @QPaysTaxes Ah nice. I noticed the same thing as you: why first convert it to int and then back to string again. I also never used CJam and didn't really look close enough at all the possible operators, so I was unable to find a solution on first glance. Thanks for sharing your approach without converting it back to string, even though it's the same byte-length. – Kevin Cruijssen Jul 7 '16 at 11:40 • If there was a way to apply an operation to the whole stack in two bytes, it would be a byte shorter (something like r__+si*, where s is "apply this operation over the stack"), but I don't see anything like that – Fund Monica's Lawsuit Jul 7 '16 at 11:43 # Jelly, 8 6 bytes ŒṘẋ2v×  Try it online! ## Explanation ŒṘẋ2v× - Main link. Left argument: the number to convert × - Multiply v - an evaluation of the left argument ŒṘ - converted to string ẋ - multiplied by 2 - two and the left argument  • I don't think you need either of those ³s. – Martin Ender Jul 7 '16 at 11:41 # Awk, 13 bytes $0=($0$0)*$0  Set the line to 2 of itself multiplied by itself # 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? – Leaky Nun Jul 7 '16 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 * – Luis Mendo Jul 7 '16 at 14:51 • Ah. I was searching for something like the 42th function. – Leaky Nun Jul 7 '16 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 – Luis Mendo Jul 7 '16 at 14:58 # 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 Jul 7 '16 at 16:56 • I don't think you need -l – Brad Gilbert b2gills Jul 7 '16 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 Jul 7 '16 at 18:04
• I was testing it with both Perl 5 and 6, and didn't notice that I forgot to remove the 6. – Brad Gilbert b2gills Jul 7 '16 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 – GER_Moki Jul 7 '16 at 18:38
• I would need some form of input box to get the value, no? – tjb1 Jul 7 '16 at 18:39
• Try Sub B(a) MsgBox (a & a) * a End Sub – GER_Moki Jul 7 '16 at 18:42
• That requires another sub to pass the value, I'm not sure that's allowed in golf. – tjb1 Jul 7 '16 at 18:44
• The Function must be called too ;) – GER_Moki Jul 7 '16 at 18:47

## 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. – Leaky Nun Jul 18 '16 at 8:22

## 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)*"$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.

$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! – Joe Jul 7 '16 at 20:38 # 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 – TessellatingHeckler Jul 7 '16 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" – ThePoShWolf Jul 8 '16 at 14:59 • Err, I take that back, mine is one byte longer! – ThePoShWolf Jul 8 '16 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. – AdmBorkBork Jul 12 '16 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? – TessellatingHeckler Jul 12 '16 at 19:21

## Batch, 2720 18 bytes

@cmd/cset/a%1%1*%1


Edit: Saved 7 bytes thanks to @TessellatingHeckler. Saved a further 2 bytes thanks to @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ.

• set /a at the prompt outputs the result of the assignment. -> @cmd/c set/a n=%1%1*%1 for 22 bytes. – TessellatingHeckler Jul 7 '16 at 19:55
• @TessellatingHeckler Why bother assigning if you're outputting? – Neil Jul 7 '16 at 20:28
• @TessellatingHeckler Huh, I already did this trick myself six weeks ago, and I've forgotten it already.. – Neil Jul 8 '16 at 12:35
• @cmd/cset/a%1%1*%1 for 18. – Erik the Outgolfer Jul 15 '16 at 10:51
• @Neil Nope, but I tested it (on Windows 10!) The cmd/c part is needed because the batch file executing tool is not cmd itself. – Erik the Outgolfer Jul 15 '16 at 15:38