Print a bunch of uninteresting numbers!

40

6

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.

Seims

Posted 2016-07-07T10:25:58.573

Reputation: 631

Does this mean that floats more than zero are also valid inputs? Or are only integers valid? – R. Kap – 2016-07-07T10:42:08.690

R.Kap: No, only whole numbers. Everything else would need a lot of specification. :) – Seims – 2016-07-07T10:43:53.943

Both positive and negative? Or only positive? – R. Kap – 2016-07-07T10:44:57.423

No, only positive. – Seims – 2016-07-07T10:45:25.023

@R.Kap can be anything as long as it's > 0 :p – weston – 2016-07-07T10:46:06.170

10There must be a relevant OEIS entry... – MKII – 2016-07-07T10:52:04.767

@MKII Can be described as 11n^2 for 1-digit-numbers. Otherwise no. – Seims – 2016-07-07T10:53:25.863

@MKII Sadly, no there is not.

– R. Kap – 2016-07-07T10:53:36.383

1@Seims It was a joke, based on the "uninsteresting" name – MKII – 2016-07-07T11:10:34.450

10@MKII my bad, i don't speak joke – Seims – 2016-07-07T11:13:01.690

1Is taking the number as a string argument bending the rules a bit too much? – Dom Hastings – 2016-07-07T11:39:51.533

^^ I was just about to ask the same – Luis Mendo – 2016-07-07T11:43:49.410

1Go ahead, bend the rules! :P – Seims – 2016-07-07T11:44:34.640

For those who didn't understand my post: https://en.wikipedia.org/wiki/Interesting_number_paradox

– thepiercingarrow – 2016-07-07T13:44:02.227

@MKII I checked there isn't :( – thepiercingarrow – 2016-07-07T15:19:30.517

This reminds me of the proof that there are no non-interesting natural numbers. By counterexample, suppose there are some non-interesting natural numbers. Let n be the least of those. Then n is the smallest non-interesting natural number, which is interesting. Thus n is not non-interesting, which is a contradiction. Thus, there are no non-interesting natural numbers. – Joshua Taylor – 2016-07-07T21:09:00.567

Could we take input as a unit type which coerces to an integer? – MayorMonty – 2016-07-10T18:20:54.490

Never mind, someone already posted exactly what I had in mind, good job @DomHastings – MayorMonty – 2016-07-10T18:22:24.857

@JoshuaTaylor only if non-interesting is defined that specific way. you could just define it so it doesn't lead to a paradox :P – ASCII-only – 2018-04-17T11:47:20.187

Answers

39

05AB1E, 3 bytes

Ы*

Explained

Ð    # triplicate input
 «   # conactenate
  *  # multiply

Try it online

Emigna

Posted 2016-07-07T10:25:58.573

Reputation: 50 798

2Ahh, nice! Ninja'd me by seconds :p. – Adnan – 2016-07-07T10:44:56.777

3@Adnan Hehe. Revenge for that time you did it to me :P – Emigna – 2016-07-07T10:46:18.673

@Emigna Nice job! Didn't think this could be THIS short. – Seims – 2016-07-07T10:47:49.693

13 operations, 3 bytes, I don't think you could make it any shorter than that. – Lasse Meyer – 2016-07-07T11:20:14.250

@youtubefreak It seems unlikely. If a language by default takes the same input multiple times if no more input exist it would be possible with a 2 byte solution, assuming it had 1 byte operations for concat and multiplication as well as the possibility to interpret datatypes correctly for those types. – Emigna – 2016-07-07T11:28:48.830

Wait... So concatenate works for int? Cool! – busukxuan – 2016-07-07T11:44:01.007

2@busukxuan Yep. Concatenate automatically converts the number to str and * interprets the string as a number. Very useful :) – Emigna – 2016-07-07T11:50:29.963

@Emigna So pyth loses because it overloads too much lol – busukxuan – 2016-07-07T11:52:18.430

2@busukxuan Yeah, a combination of Pyth and 05AB1E could have done it in 2 bytes :) – Emigna – 2016-07-07T12:01:16.047

What encoding does 05AB1E use? – Ash Burlaczenko – 2016-07-07T15:06:52.450

1

@AshBurlaczenko 05AB1E uses the CP-1252 encoding.

– Adnan – 2016-07-07T15:13:19.587

29

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.

Dom Hastings

Posted 2016-07-07T10:25:58.573

Reputation: 16 415

1If you can pass the parameter as a string you can cut two bytes off this solution: _=>(_+_)*+_ – Quill – 2016-07-07T11:34:08.250

3How 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 – 2016-07-07T13:11:24.357

@charredgrass $ would also work – cat – 2016-07-07T13:13:14.350

@charredgrass the => defines a function with _ as the named argument. So I could have used $ (as @cat said) or a letter, but in my original version I was going for more ASCII art than anything else! – Dom Hastings – 2016-07-07T13:22:04.020

11type casting abuse eleven – Downgoat – 2016-07-07T15:41:50.440

3Out 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)}`nn. Even recursion took me 32 bytes:f=(n,m=1)=>n<m?-~mnn:f(n,m*10)` – Neil – 2016-07-07T18:48:37.450

24

Java 8, 29 26 25 21 Bytes

God bless lambda

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

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

user902383

Posted 2016-07-07T10:25:58.573

Reputation: 1 360

28You 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 – 2016-07-07T11:15:33.210

3java is bae, lambda is bae – Seims – 2016-07-07T11:31:46.813

3@KevinCruijssen i still have a hope, one day java will win codegolf contest – user902383 – 2016-07-07T11:51:38.560

1

After your edit you outgolfed @MartinEnder with his Retina answer by 1 byte! o.Ô

– Kevin Cruijssen – 2016-07-07T12:39:04.963

1@KevinCruijssen but still not enough to win or at least beat python:( – user902383 – 2016-07-07T13:08:22.723

Why not Int.decode? – David Conrad – 2016-07-10T12:33:12.700

Also, do you need the semicolon? – David Conrad – 2016-07-10T12:34:14.320

@DavidConrad I'm not sure, do i need it? – user902383 – 2016-07-10T17:13:27.890

This is not a valid Java program. It doesn't compile. – pts – 2016-07-11T13:43:16.493

1@pts you are correct, this is not a java program, it is single java function written using lambda notation. – user902383 – 2016-07-11T13:54:32.650

I'm not completely sure, but I've submitted an answer before where I didn't include the semicolon on the rationale that the lambda could be passed to a method taking (in this case) a Function<Int, Int> parameter, in which case it wouldn't be immediately followed by a semicolon. (Sorry to not check back and reply sooner.) http://codegolf.stackexchange.com/a/84991/794

– David Conrad – 2016-07-13T01:11:18.740

Aaaah! Except I had a complete brain fart and led you astray when I suggested Int.decode. Of course it's Integer.decode, and Long.decode is shorter. But I really don't think you need to count the semicolon. Anyway, sorry! – David Conrad – 2016-07-13T01:22:58.407

@DavidConrad hmm... if i don't need semicolon, can reduce some of my other java 8 solutions, thanks for tip:) and about your Int suggestion. i feel like idiot, i update it without thinking about it, or checking:) reason why i used long in first place was to avoid using Integer, but thanks anyway – user902383 – 2016-07-13T08:29:50.233

Yeah, I feel like an idiot, too. I've been using some other languages recently, like Scala, where there is a capital-I Int type, although even there you have to write Integer.decode. – David Conrad – 2016-07-13T10:03:40.137

20

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

Doorknob

Posted 2016-07-07T10:25:58.573

Reputation: 68 138

11 what? bytes? – Insane – 2016-07-07T22:35:33.663

3@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 – 2016-07-07T22:44:25.270

http://v.tryitonline.net/#code=QxI9EiISIioSIgo&input=MTI To bad <C-r> is unprintable. – James – 2016-07-09T07:56:26.277

Is <C-r> a carriage return? – Captain Man – 2016-07-11T13:58:47.417

@CaptainMan No, <C-r> is control plus r. Carriage return is <cr>. – Doorknob – 2016-07-11T14:15:49.277

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

Test it here.

busukxuan

Posted 2016-07-07T10:25:58.573

Reputation: 2 728

15

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|

YSC

Posted 2016-07-07T10:25:58.573

Reputation: 732

3Hi, and welcome to PPCG! Nice first post! – Rɪᴋᴇʀ – 2016-07-07T14:54:31.950

13

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)

R. Kap

Posted 2016-07-07T10:25:58.573

Reputation: 4 730

I still find Phytons String operations magical... – Seims – 2016-07-07T10:34:02.743

@Seims in what way? – busukxuan – 2016-07-07T11:36:23.500

String multiplication and addition. Haven't seen that often. – Seims – 2016-07-07T11:37:03.483

@Seims I guess you mostly deal with static languages then? – busukxuan – 2016-07-07T11:42:12.207

@busukxuan Call me a noob if you want :^) – Seims – 2016-07-07T11:44:10.327

@Seims Nah, more likely I'm the noob here :P Anyway this is almost gonna become a chat so I guess we stop here xD – busukxuan – 2016-07-07T11:46:32.273

It should be noted that this only works for values up to 9223372036854775807, since any higher and repr(f) would have an L at the end. See example.

– mbomb007 – 2016-07-07T18:32:15.990

@mbomb007 I see. Well then, in that case, lambda f:int(str(f)*2)*f seems to be the best choice for numbers higher than that. – R. Kap – 2016-07-07T19:20:57.473

It's sad that a third of this answer is Python's verbose lambda syntax – Cyoce – 2017-02-22T23:59:38.777

12

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;};

weston

Posted 2016-07-07T10:25:58.573

Reputation: 371

4This is a snippet, not a full program or function. It would be valid with e.g. (n)=>{int.Parse(""+n+n)*n}2 – cat – 2016-07-07T13:12:33.977

@cat better? do I need the trailing ;? – weston – 2016-07-07T13:22:03.437

I don't know. See also Defaults for Code Golf and Tips for golfing in C#

– cat – 2016-07-07T16:12:47.697

11

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

Essari

Posted 2016-07-07T10:25:58.573

Reputation: 541

1It's a really happy winking face with a goatee! ;DDx – cat – 2016-07-07T16:11:33.853

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 – 2016-07-09T01:49:52.210

@o11c Jelly uses its own custom code page where these characters are one byte each. – a spaghetto – 2016-07-12T17:34:43.077

10

C, 70 68 54 53 52 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;
}

Test results:

$ ./84712 1 2 3 4 10 174
1 -> 11
2 -> 44
3 -> 99
4 -> 176
10 -> 10100
174 -> 30306276

Try it online!

owacoder

Posted 2016-07-07T10:25:58.573

Reputation: 1 556

f(n){int b=1;while(a)b*=10,a/=10;return(n+n*b)*n;} – Leaky Nun – 2016-07-07T13:08:05.443

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 – 2016-07-07T14:16:19.127

@Leaky - you didn't put anything into a... – Toby Speight – 2016-07-07T14:16:39.380

1It's nice to see another answer that stays entirely within the arithmetic world (not doing string concatenation). :-) – Toby Speight – 2016-07-07T14:31:10.403

1@Toby - String concatenation in C is incompatible with golfing. ;-) – owacoder – 2016-07-07T14:32:27.860

9

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

Luis Mendo

Posted 2016-07-07T10:25:58.573

Reputation: 87 464

2I 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 – 2016-07-07T11:34:41.620

@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 – 2016-07-07T11:40:06.177

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 – 2016-07-07T11:43:39.537

9

Dyalog APL, 7 bytes

⊢×#⍎⍕,⍕

string representation

⍕, prepend string representation

#⍎ make into number (in root namespace)

⊢× multiply by original number

Adám

Posted 2016-07-07T10:25:58.573

Reputation: 37 779

1Those wrecked TIE fighters are funny! – Luis Mendo – 2016-07-07T11:13:56.860

2

@LuisMendo http://www.dyalog.com/blog/2015/12/apl-puns/

– Adám – 2016-07-07T12:09:45.463

1The fork awakens :-D – Luis Mendo – 2016-07-07T12:28:06.607

I'm pretty sure those aren't bytes in any encoding, since they're not letterlike or very common. – o11c – 2016-07-09T01:51:23.877

@o11c Did you check out the preemptive link for the word "bytes", viz. http://meta.codegolf.stackexchange.com/a/9429/43319.

– Adám – 2016-07-10T01:19:19.780

@Adám So languages can just make up new character sets, that no one can verify easily since they're not part of the standard iconv tables? – o11c – 2016-07-10T06:28:05.177

@o11c They can make up new codepages, but they must be well-defined before challenge-submission. See an example here of someone about to do just that. And here is an example of someone who already did it.

– Adám – 2016-07-10T11:11:27.693

@o11c The character set doesn't really matter - it's just a way to represent the bytes. The sequence of bytes is the part that matters for us, since everything is scored in bytes. – Mego – 2016-07-12T21:47:41.780

9

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

miles

Posted 2016-07-07T10:25:58.573

Reputation: 15 654

+1. I couldn't even think that Under is working properly with string concatenation. What a great discovery for me! Thank you. – Dan Oak – 2016-07-15T06:04:26.280

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 – 2016-07-15T06:06:28.150

1@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 – 2016-07-15T06:11:51.993

Ah, I got this, ty. – Dan Oak – 2016-07-15T09:50:33.603

9

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.

Martin Ender

Posted 2016-07-07T10:25:58.573

Reputation: 184 808

Ooh, so close to being as long as Java. Outgolfed it by just 2 bytes. +1 – R. Kap – 2016-07-07T11:21:16.920

@R.Kap Actually, Java 8 outgolfed it after removing 3 bytes! o.Ô – Kevin Cruijssen – 2016-07-07T12:36:37.797

4Sorry, Java.... – Martin Ender – 2016-07-07T13:16:25.657

8

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

user48538

Posted 2016-07-07T10:25:58.573

Reputation: 1 478

1I don't think you need either of those ³s. – Martin Ender – 2016-07-07T11:41:55.717

8

Awk, 13 bytes

$0=($0$0)*$0

Set the line to 2 of itself multiplied by itself

User112638726

Posted 2016-07-07T10:25:58.573

Reputation: 201

7

Brachylog, 7 bytes

:?c:?*.

Explanation

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

Fatalize

Posted 2016-07-07T10:25:58.573

Reputation: 32 976

7

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

Or try it online with ideone.

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.

Luis Mendo

Posted 2016-07-07T10:25:58.573

Reputation: 87 464

What does 42 mean? – Leaky Nun – 2016-07-07T14:45:50.837

4

@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 – 2016-07-07T14:51:34.777

Ah. I was searching for something like the 42th function. – Leaky Nun – 2016-07-07T14:54:22.343

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 – 2016-07-07T14:58:11.473

7

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!

Leaky Nun

Posted 2016-07-07T10:25:58.573

Reputation: 45 011

6

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

Luis Mendo

Posted 2016-07-07T10:25:58.573

Reputation: 87 464

6

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

Katenkyo

Posted 2016-07-07T10:25:58.573

Reputation: 2 857

That can be a nice demonstration of type coercion... if you add the explanation in. – Leaky Nun – 2016-07-18T08:22:43.500

6

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]

Doorknob

Posted 2016-07-07T10:25:58.573

Reputation: 68 138

6

Perl, 11 bytes

$_*=$_ x2

+ the p and l flags.

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

-2 bytes thanks to pipe.

Dada

Posted 2016-07-07T10:25:58.573

Reputation: 8 279

Save two bytes: $_*=$_ x2 – pipe – 2016-07-07T16:56:14.777

I don't think you need -l – Brad Gilbert b2gills – 2016-07-07T17:56:26.347

@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 – 2016-07-07T18:04:53.900

I was testing it with both Perl 5 and 6, and didn't notice that I forgot to remove the 6. – Brad Gilbert b2gills – 2016-07-07T18:08:32.780

6

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

tjb1

Posted 2016-07-07T10:25:58.573

Reputation: 561

Think about a MsgBox and a Sub. It will save you 13 Byte, if I count correctly – GER_Moki – 2016-07-07T18:38:17.417

I would need some form of input box to get the value, no? – tjb1 – 2016-07-07T18:39:37.367

Try Sub B(a) MsgBox (a & a) * a End Sub – GER_Moki – 2016-07-07T18:42:42.830

That requires another sub to pass the value, I'm not sure that's allowed in golf. – tjb1 – 2016-07-07T18:44:53.080

The Function must be called too ;) – GER_Moki – 2016-07-07T18:47:02.113

If the characters for calling the sub/function are counted then the function would be shorter. – tjb1 – 2016-07-07T18:49:49.630

This doesn't count. See all the other answers – GER_Moki – 2016-07-07T18:50:50.680

5

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

Blue

Posted 2016-07-07T10:25:58.573

Reputation: 26 661

5

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.

user55641

Posted 2016-07-07T10:25:58.573

Reputation: 171

5

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).

Toby Speight

Posted 2016-07-07T10:25:58.573

Reputation: 5 058

You can substitute A for 10 to save a byte. Well done! – Joe – 2016-07-07T20:38:39.290

4

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!

ThePoShWolf

Posted 2016-07-07T10:25:58.573

Reputation: 171

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 – 2016-07-07T19:51:11.153

Hmmm... Interesting point. I can also switch them using my same structure and achieve the same result: param($a);$a*"$a$a" – ThePoShWolf – 2016-07-08T14:59:23.863

Err, I take that back, mine is one byte longer! – ThePoShWolf – 2016-07-08T15:00:31.470

@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 – 2016-07-12T19:18:08.320

@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 – 2016-07-12T19:21:24.107

@TessellatingHeckler Hrm. Perhaps a Meta question should be posed. – AdmBorkBork – 2016-07-12T19:42:08.427

4

Batch, 27 20 18 bytes

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

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

Neil

Posted 2016-07-07T10:25:58.573

Reputation: 95 035

set /a at the prompt outputs the result of the assignment. -> @cmd/c set/a n=%1%1*%1 for 22 bytes. – TessellatingHeckler – 2016-07-07T19:55:18.450

@TessellatingHeckler Why bother assigning if you're outputting? – Neil – 2016-07-07T20:28:28.740

@TessellatingHeckler Huh, I already did this trick myself six weeks ago, and I've forgotten it already.. – Neil – 2016-07-08T12:35:25.867

@cmd/cset/a%1%1*%1 for 18. – Erik the Outgolfer – 2016-07-15T10:51:41.150

@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ Huh, would you believe it? – Neil – 2016-07-15T15:36:49.367

1@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 – 2016-07-15T15:38:49.550

4

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. :-)

zmerch

Posted 2016-07-07T10:25:58.573

Reputation: 541

3

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

Brad Gilbert b2gills

Posted 2016-07-07T10:25:58.573

Reputation: 12 713

2

Brachylog (2), 4 bytes

j:?×

Try it online!

Explanation

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

user62131

Posted 2016-07-07T10:25:58.573

Reputation:

2

Wren, 41 bytes

Fn.new{|n|Num.fromString(n.toString*2)*n}

Try it online!

Explanation

Fn.new{|n|                              } // New function with the parameter n
                         n.toString       // Convert the number to a string
                                   *2     // Duplicate this value
          Num.fromString(            )    // Convert to a number
                                      *n  // Multiply it with the original number

user85052

Posted 2016-07-07T10:25:58.573

Reputation:

2

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

cliffroot

Posted 2016-07-07T10:25:58.573

Reputation: 1 080

2

SpecBAS - 30 bytes

1 INPUT n$: ?VAL(n$+n$)*VAL n$

My shortest SpecBAS answer yet :-)

Brian

Posted 2016-07-07T10:25:58.573

Reputation: 1 209

2

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. :)

Seims

Posted 2016-07-07T10:25:58.573

Reputation: 631

I was a bout to post an answer using a similar approach... by the way it is python not phyton. – Leaky Nun – 2016-07-07T12:52:01.460

@LeakyNun Code doesn't work either. Will look into it. – Seims – 2016-07-07T12:53:05.057

1Add from math import* to the beginning of your submission, and you can remove g= from the byte count. – Leaky Nun – 2016-07-07T12:55:47.797

1Changing 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 – 2016-07-07T18:14:15.143

2

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.

pajonk

Posted 2016-07-07T10:25:58.573

Reputation: 2 480

2

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

nicael

Posted 2016-07-07T10:25:58.573

Reputation: 4 585

This can now be 2 bytes, for the win!

– Shaggy – 2018-02-02T17:49:30.737

2

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"

Zylviij

Posted 2016-07-07T10:25:58.573

Reputation: 390

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 – 2016-07-10T09:26:08.430

2

><>, 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.

cole

Posted 2016-07-07T10:25:58.573

Reputation: 3 526

1

TI-Basic, 9 bytes

Input should be passed as string

expr(Ans)expr(Ans+Ans

Timtech

Posted 2016-07-07T10:25:58.573

Reputation: 12 038

1

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

Paul Kerrigan

Posted 2016-07-07T10:25:58.573

Reputation: 189

1

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:
{
 Discard stack height
 {}
 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
({}<>)({<({}[()])><>({})<>}{})

DLosc

Posted 2016-07-07T10:25:58.573

Reputation: 21 213

1

Keg, 7 bytes

::⑫++ℤ*

Try it online!

Simply duplicate the input twice, push an empty string, add the input to that string, convert to integer and multiply by original input

Lyxal

Posted 2016-07-07T10:25:58.573

Reputation: 5 253

1

GolfScript, 7 bytes

.2*~\~*

Try it online!

Explanation:

.2*       duplicate, concatenate duplicate to self
   ~\~    convert both strings to ints
      *   multiply

Pseudo Nym

Posted 2016-07-07T10:25:58.573

Reputation: 181

1

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

Emigna

Posted 2016-07-07T10:25:58.573

Reputation: 50 798

1

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

Mego

Posted 2016-07-07T10:25:58.573

Reputation: 32 998

1

R 34 bytes

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

bouncyball

Posted 2016-07-07T10:25:58.573

Reputation: 401

1

I think the numeric approach is faster ;-) Nice answer however, I didn't know paste converts numbers to strings implicitly.

– pajonk – 2016-07-07T17:28:04.647

1

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

user47018

Posted 2016-07-07T10:25:58.573

Reputation:

1

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    )

mbomb007

Posted 2016-07-07T10:25:58.573

Reputation: 21 944

1

Mathematica, 24 bytes

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

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

LegionMammal978

Posted 2016-07-07T10:25:58.573

Reputation: 15 731

1

Coffeescript, 36 34 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

clismique

Posted 2016-07-07T10:25:58.573

Reputation: 6 600

parseInt((""+n)+n)? – Steven H. – 2016-07-07T21:35:46.777

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 – 2016-10-03T03:15:05.297

@joeytwiddle Ah yeah... I posted this ages ago, so... – clismique – 2016-10-03T03:22:34.053

1

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

Alexis Andersen

Posted 2016-07-07T10:25:58.573

Reputation: 591

1

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

TuxCrafting

Posted 2016-07-07T10:25:58.573

Reputation: 4 547

1

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.

Sok

Posted 2016-07-07T10:25:58.573

Reputation: 5 592

1

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)]];

TuxCrafting

Posted 2016-07-07T10:25:58.573

Reputation: 4 547

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.

ATaco

Posted 2016-07-07T10:25:58.573

Reputation: 7 898

0

PHP, 32 bytes

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

Try it online!

Tom291

Posted 2016-07-07T10:25:58.573

Reputation: 313

0

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

Giacomo Garabello

Posted 2016-07-07T10:25:58.573

Reputation: 1 419

Be careful with that main() loop - most implementations don't leave enough space for the strcat() in there. – Toby Speight – 2016-07-07T16:14:07.623

1BTW, 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 – 2016-07-07T16:16:44.407

True!! I wrote the full program version in a rush... – Giacomo Garabello – 2016-07-07T16:19:10.527

0

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

SuperJedi224

Posted 2016-07-07T10:25:58.573

Reputation: 11 342

0

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.

Steven H.

Posted 2016-07-07T10:25:58.573

Reputation: 2 841

0

Common Lisp (Lispworks), 91 78 77 bytes

(defun f(n)(*(parse-integer(concatenate'string #1=(write-to-string n)#1#))n))

sadfaf

Posted 2016-07-07T10:25:58.573

Reputation: 101

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? – James – 2016-07-08T07:20:45.023

Is the newline is necessary? not necessary – sadfaf – 2016-07-08T07:31:03.357

I'm not sure, that's why I'm asking you. Will this still run if you combined it into one line? – James – 2016-07-08T07:34:12.507

yes, lisp separative sign is parentheses or blank space (etc. tabbar\Spacebar) – sadfaf – 2016-07-08T07:44:49.960

0

Python 3, 43 bytes

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

Dave Lin

Posted 2016-07-07T10:25:58.573

Reputation: 71

0

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

Joe

Posted 2016-07-07T10:25:58.573

Reputation: 283

0

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

Conor O'Brien

Posted 2016-07-07T10:25:58.573

Reputation: 36 228

0

T-SQL, 45 bytes

DECLARE @i INT = 12
SELECT CONCAT(@i, @i)*@i

Nelz

Posted 2016-07-07T10:25:58.573

Reputation: 321

0

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).

Conor O'Brien

Posted 2016-07-07T10:25:58.573

Reputation: 36 228

0

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.

MildCorma

Posted 2016-07-07T10:25:58.573

Reputation: 39

0

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.

haykam

Posted 2016-07-07T10:25:58.573

Reputation: 784