# 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

# Perl 6, 11 bytes

{"$_$_"*$_}  #! /usr/bin/env perl6 use v6.c; use Test; my @tests = ( 12 => 14544, 1 => 11, 2 => 44, 3 => 99, 10 => 10100, 174 => 30306276, ); plan +@tests; my &uninteresting = {"$_$_"*$_}

for @tests -> $_ ( :key($input), :value($expected) ) { is uninteresting($input), $expected, .gist }  1..6 ok 1 - 12 => 14544 ok 2 - 1 => 11 ok 3 - 2 => 44 ok 4 - 3 => 99 ok 5 - 10 => 10100 ok 6 - 174 => 30306276  # Clojure, 22 bytes #(*(bigint(str % %))%)  Anonymous function which concatenates string representation of its argument covnerts it to BigInteger and multiplies by the argument. The output is in format 11N (N signifies its a bigint), if there should be no N at the end then we can use #(*(read-string(str % %))%)  for 27 bytes. See it online: https://ideone.com/QqYfpo # SpecBAS - 30 bytes 1 INPUT n$: ?VAL(n$+n$)*VAL n$ My shortest SpecBAS answer yet :-) # Python, 51 Bytes from math import* g=lambda x:x*(x+x*10**(1+int(log10(x))))  Here's the mathematical way to do it (friend of mine found the formula). I guess using it wouldn't produce an answer shorter than 3 bytes. :) • I was a bout to post an answer using a similar approach... by the way it is python not phyton. – Leaky Nun Jul 7 '16 at 12:52 • @LeakyNun Code doesn't work either. Will look into it. – Seims Jul 7 '16 at 12:53 • Add from math import* to the beginning of your submission, and you can remove g= from the byte count. – Leaky Nun Jul 7 '16 at 12:55 • Changing from 10**(1+int(log10(x))) to 10**-~int(log10(x)) saves you bytes on parentheses. Changing from x*(x+x*10**... to x*x*-~10**... also saves bytes on parentheses. – Sherlock9 Jul 7 '16 at 18:14 ## R, 28 bytes z=scan();(z+z*10^nchar(z))*z  Shorter than bouncyball's solution with different approach. Explanation z=scan() gets input z+z*10^nchar(z)) is concatenation of the two copies of the number *z at the end to get the result. ## Japt, 4 bytes U²*U  ² translates to p2, which was (seemingly) designed to shorten the syntax for raising the number to the power of two. For strings, p function is repeating, not exponentiating, but the shortcut still works :) As you may've understood, takes the input as string. Demo • This can now be 2 bytes, for the win! – Shaggy Feb 2 '18 at 17:49 # Haskell, 22 I'm new to Haskell (and functional programming), so expert criticism is welcome. f n=(read$n++n)*read n

main=do
putStrLn $show$ f "1"
putStrLn $show$ f "2"
putStrLn $show$ f "3"
putStrLn $show$ f "10"
putStrLn $show$ f "174"

• You technically didn't fulfill the requirements. It says to use numbers as input, you used strings. I had the same idea before I realized that. ;) – AplusKminus Jul 10 '16 at 9:26

# ><>, 22 Bytes

a:{:@)8$.$a*!
::{*+*n;


Input is expected to be on the stack already. If that's not okay, then I'll probably mark this answer non-competing. Reading numeric inputs in ><> is a real pain. Try it online

On a side note, this is my first post after a long period of inactivity; I'm glad to be able to contribute to this wonderful community again.

## Explanation

I'm using the term "padding" to refer to a "variable"* that the input will be multiplied so that its digits may be duplicated.

e.g. if 12 is our input N and 1212 is the number O, then the padding used would be 100 since 12*100 + 12 = 1212.

*><> doesn't exactly have those, aside from the register (&), but you can effectively have them by manipulating the stack if that makes sense

### Line 1

a:{:@)8$.$a*!
a              push initial padding value (10)
:{:           duplicate padding, bring input to front of stack and duplicate it
@          manipulate stack so that it looks like [padding,input,padding,input]
)         pop input and padding from top and push the result of (padding > input)
8$. push 8 and swap with the result, then jump to that location$     swap top so it looks like [input,padding]
a*!  multiply padding by 10, skip pushing 10 at beginning


### Line 2

::{*+*n;
::        duplicate input twice -> [padding,input,input,input]
{       bring padding from bottom -> [input,input,input,padding]
*      multiply first input copy by padding
+     add it to the second copy
*    multiply by the final copy
n   print result
;  terminate


Here's a hopefully more readable explanation.

### Line 1

a:{:@)8$.$a*!


The program initializes the stack so that it contains [input,10] (10 is the initial padding value). It then checks to see if the padding is greater than the input. The result of this (1 if true, 0 if false) is pushed onto the top of the stack. The pointer then jumps to the location (8,padding>input), which means that if the padding is greater than the input, the program goes to the second line and if it isn't it continues along on the first line. If it continues on the first line, it'll multiply the padding by 10 and repeat the process.

### Line 2

::{*+*n;


On Line 2, the program duplicates the input twice and then evaluates the expression input*((input*padding) + input) and prints it.

# Brachylog (2), 4 bytes, language postdates challenge

j:?×


Try it online!

## Explanation

j:?×
j     Append the input to itself
: ×  then multiply by
?   the original input


## Fishing, 26 bytes

v+CCCCCCCCCC
Icc{n{n}mP


Explained column-by column

1. Set casting direction downwards
2. Increase casting length to 1
3. Read input to first cell on tape
4. Concatenate first and second (empty) cell on tape and add to end of tape
5. Concatenate first and second (now containing input) cell and add to end of tape
6. Move to second cell (containing input)
7. Cast cell content to number
8. Move to third cell (containing input twice)
9. Cast cell content to number
10. Move to second cell.
11. Set content of second cell to second cell multiplied by third cell
12. Print second cell content

## Actually, 7 bytes

;;+k♂≈π


Try it online!

Explanation:

;;+k♂≈π
;;       duplicate input twice (3 total copies)
+      concatenate two of the copies
k♂≈   push to a list, convert all elements to ints
π  product


## R 34 bytes

y=scan();as.numeric(paste0(y,y))*y

• I think the numeric approach is faster ;-) Nice answer however, I didn't know paste converts numbers to strings implicitly. – pajonk Jul 7 '16 at 17:28

# hashmap, 8 bytes

i&&+d#d*


Explanation:

i&&+d#d*
i&&      Triple the input
+     Add them together
d#d  Convert both into a number
* Multiply them


# Forth, 63 bytes

This feels horribly inefficient...

: f dup 2dup 10e s>f flog 1e f+ floor f** s>f f* s>f f+ f>s * ;


Try it online

Note that this works on Ideone (gforth-0.7.2), but not repl (JS-Forth), since repl doesn't support pushing numbers to the float stack or the flog and floor operations.

### Explanation

: f                     ( define a word/function named 'f'              )
dup 2dup                ( duplicate 3 times                             )
10e                     ( push 10 to float stack, not used for log{n}   )
s>f flog                ( move # to f-stack and get its log-10          )
1e f+ floor             ( increment the above result by 1 and floor     )
f**                     ( use the 10 pushed earlier, 10**log{n}         )
s>f f* s>f f+           ( mul by n, then add n                          )
f>s * ;                 ( to regular stack, mul by n, end definition    )


# Mathematica, 24 bytes

a=FromDigits;a[#<>#]a@#&


Anonymous function, takes a string representing a number as input and generates its corresponding uninteresting number.

# Ruby, 22 Bytes

->n{(n*2).to_i*n.to_i}


Takes input as a string. Double the string, and then multiply it by the input, both as integers

## Your mom, 6 bytes (non-competing)

ð::+*


Non-competing since the language is newer than the challenge.
The name of this language is a idea from mbomb007...

Explanation:

ð     Read a string from stdin
::   : is the duplicate operator, so the input is duplicated 2 times
+*
Implicit output


# Hexagony, 23 bytes

?'=1*'\|@}*\=+=':<\}0.!


Embiggened:

    ? ' = 1
* ' \ | @
} * \ = + =
' : < \ } 0 .
! . . . . .
. . . . .
. . . .


Try it online!

As Hexagony doesn't have a concatenation function, it has to be done through multiplying the input by the appropriate factor of 10, then adding the input to it again. For example, CONCAT(12,12) can be implemented as (12 * 100) + 12.

## Logy, 40 bytes (non-competing)

main[A]->print[atoi[A(1)*2]*atoi[A(1)]];


Ungolfed:

main[Args] -> print[atoi[Args(1)*2]*
atoi[Args(1)]];


# RProgN, 9 Bytes

] ] . * _


## Explanation

] ]     # Push two copies of the top of the stack, which implicitly contains the input.
.       # Concatenate the top two values of the stack, and push it to the top of the stack.
*       # Multiply the top two values of the stack
_       # Floor the top of the stack, to make it pretty.
# Implicitly print


Yay for Stack Based Loosly typed languages. The main downside of RProgN is that (Currently) whitespace is needed for a function to run (Aside from the last command). Which wastefully adds four whole bytes.

# Coffeescript, 3634 19 bytes

Thanks to @Fawful for shaving off 2 bytes, and to @joeytwiddle for some more

a=(n)->(""+n+n|0)*n


Neater script and explanation:

a=(n)->               # Creates a new function
(""+n+n|0)     # Concatenate as strings, then convert back to integer
*n   # then multiplies it by n

• parseInt((""+n)+n)? – Steven H. Jul 7 '16 at 21:35
• You can use Number() instead of parseInt(). Or even better you can use |0. Also there is no need for return. We can reach 19 in CS, 17 in ES6. ;) – joeytwiddle Oct 3 '16 at 3:15
• @joeytwiddle Ah yeah... I posted this ages ago, so... – Qwerp-Derp Oct 3 '16 at 3:22

# TI-Basic, 9 bytes

Input should be passed as string

expr(Ans)expr(Ans+Ans


# k, 14 bytes:

{x*"J"$s,s:$x}


Explanation:

x              // implicit input
$// string the input s: // set variable s to.. s,s // append s to s "J"$   // cast to 64bit int
x*  // multiply by original input, return is implicit


# Brain-Flak, 226 bytes

((({}))){(({})(<><>))<>((()())(({}){}){}){(({})){({}[()])<>}{}}{}<>([{}()]{})(<>{}(<>))<>((()())(({}){}){})([()]{()<(({})){({}[()])<>}{}>}{}<><{}{}>)}{}<>([]){{}({}<>(({}){})(({}){}){})<>([])}{}<>({}<>)({<({}[()])><>({})<>}{})


Try it online!

The main idea here is to decompose N into its digits, putting the digits on the off-stack; then we can calculate O by multiplying N by 10, adding a digit from the off-stack, and repeating until the off-stack is empty. Multiplying that result by another copy of N gives the final answer. I borrowed pretty heavily from the arithmetic algorithms here, tweaking them a bit to fit into this particular program in fewer bytes.

Make two more copies of the input
((({})))
The third copy will be decomposed into its digits
Loop while the partially decomposed number is not zero:
{
Push a zero and a copy of the number
(({})(<><>))
Switch to the off-stack and push 10
<>((()())(({}){}){})
Modulo algorithm: we end up on the off-stack with number % 10 on top
{(({})){({}[()])<>}{}}{}<>([{}()]{})
Push a zero and the top of the main stack to the off-stack, popping the main stack
(<>{}(<>))
Switch to the main stack and push 10
<>((()())(({}){}){})
Division algorithm: we end up on the main stack with number / 10 on top, and without any
junk left on the off-stack
([()]{()<(({})){({}[()])<>}{}>}{}<><{}{}>)
}
Pop the leftover zero, switch to off-stack, and push stack height
{}<>([])
Loop while stack height is not zero:
{
{}
Add top of off-stack to 10 times top of main stack and push to main stack
({}<>(({}){})(({}){}){})
Switch back to off-stack and push stack height
<>([])
}
Discard stack height and switch to main stack
{}<>
Multiplication algorithm: we end up with O*N on the stack, which the program outputs
({}<>)({<({}[()])><>({})<>}{})


# ForceLang, 54 bytes, noncompeting

set a io.readnum()
io.write a.mult number.parse a+""+a


Noncompeting, because it requires a language version published after this challenge (containing a patch for a minor parse error relating to the empty string literal).

The original answer, which doesn't require this bugfix (76 bytes):

set a io.readnum()
set b a+string.builder()
io.write a.mult number.parse b+a


# Racket, 74 62 bytes

(λ(n)(*((λ(m)(string->number(string-append m m)))(~a n))n))


I hate the length of built-in function names in Racket sometimes. Other times, I discover a really concisely named version of a function and transform a number->string into ~a.

# C, 52 50 bytes

q;f(char*v){q=atoi(v);return atoi(strcat(v,v))*q;}


### Usage

q;f(char*v){q=atoi(v);return atoi(strcat(v,v))*q;}
main(c,v)char**v;{while(*++v)printf("%d\n",f(*v));}


## Full Program 75 69 bytes

q;main(c,v)char**v;{q=atoi(*++v);printf("%d",atoi(strcat(*v,*v))*q);}


-2 & -6 thanks to Toby Speight in this comment

• Be careful with that main() loop - most implementations don't leave enough space for the strcat() in there. – Toby Speight Jul 7 '16 at 16:14
• BTW, in the 'full program' version, you don't need to dereference ++v, and you can move the increment over to the next statement: {q=atoi(*++v);... I think that gains you 3 bytes. Moreover strcat() returns the start of the string, so you can use atoi(strcat(v,v))*q and atoi(strcat(*v,*v))*qrespectively. – Toby Speight Jul 7 '16 at 16:16
• True!! I wrote the full program version in a rush... – Giacomo Garabello Jul 7 '16 at 16:19

# Python 3, 43 bytes

x=int(input());print(10**len(str(x))*x+x)*x


## SAS, 32 Bytes

%macro x(a);%eval(&a&a*&a)%mend;


Macro language, so no string/numeric concept. Function style (so this doesn't return the value to the screen, that's your job, this just returns the value).

Examples:

86   %put %x(1);
11
87   %put %x(12);
14544


# Jolf, 4 bytes

Try it here!

*P+§


## Explanation

*P+§xxx
*     x   implicit input *
§x       implicit input as string
+  x      followed by implicit input
P         as a number