40
\$\begingroup\$

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.

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

69 Answers 69

1 2
3
0
\$\begingroup\$

Python 3, 43 bytes

x=int(input());print(10**len(str(x))*x+x)*x
\$\endgroup\$
0
\$\begingroup\$

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
\$\endgroup\$
0
\$\begingroup\$

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
\$\endgroup\$
0
\$\begingroup\$

Common Lisp (Lispworks), 91 78 77 bytes

(defun f(n)(*(parse-integer(concatenate'string #1=(write-to-string n)#1#))n))
\$\endgroup\$
4
  • \$\begingroup\$ I edited your answer so that it would show up as code. I don't know lisp, so I'm not sure. Is the newline is necessary? \$\endgroup\$
    – DJMcMayhem
    Jul 8 '16 at 7:20
  • \$\begingroup\$ Is the newline is necessary? not necessary \$\endgroup\$
    – sadfaf
    Jul 8 '16 at 7:31
  • \$\begingroup\$ I'm not sure, that's why I'm asking you. Will this still run if you combined it into one line? \$\endgroup\$
    – DJMcMayhem
    Jul 8 '16 at 7:34
  • \$\begingroup\$ yes, lisp separative sign is parentheses or blank space (etc. tabbar\Spacebar) \$\endgroup\$
    – sadfaf
    Jul 8 '16 at 7:44
0
\$\begingroup\$

T-SQL, 45 bytes

DECLARE @i INT = 12
SELECT CONCAT(@i, @i)*@i
\$\endgroup\$
0
\$\begingroup\$

TI-BASIC, 22 or 24 bytes

Prompt X
X(X+X10^(1+int(log(X

Or, 22 bytes stored as a Y-var (basically a function).

\$\endgroup\$
0
\$\begingroup\$

Python, 46 bytes

i=input("N:")           # Standard input
y=i+(i[-2:])            # Using strip method to take last two chars from input
print(int(y)*int(i))    # Temp convert strings into integers for maths and print the result.
\$\endgroup\$
0
\$\begingroup\$

JavaScript, 25 bytes

Golfed:

_=prompt();alert((_+_)*_)

Ungolfed:

_=prompt();
alert((_+_)*_)

Explanation:

_=prompt();    - set variable to prompt
alert((_+_)*_) - alert output, which is the number plus itself, times itself

This code was originally written by TùxCräftîñg. Their original comment with the code can be found here.

\$\endgroup\$
0
\$\begingroup\$

PHP, 32 bytes

function f($n){print($n.$n)*$n;}

Try it online!

\$\endgroup\$
1 2
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.