Robbers - square times square root

18

1

Task: Crack the scrambled code for multiplying the square root of an integer n by the square of it!

You must post a comment in the cops' thread with a link to your working source, mentioning clearly that you have Cracked it. In your answer's title, you must include the link to the original answer.

Rules:

  • You may only change the order of the characters in the original source.
  • Safe answers cannot be cracked anymore.
  • The other rules mentioned in the cops' thread
  • Please edit the answer you crack

WINNER: Emigna - 10 submissons (had some trouble counting)

Honorable mentions: Notjagan, Plannapus, TEHTMI

Mr. Xcoder

Posted 2017-04-03T12:45:28.363

Reputation: 39 774

Answers

3

NO, 41 bytes, This Guy

NOOOOOO?NOOOOOOOOOOO!nnOOOOO
NOOOOOOOO?no

Emigna

Posted 2017-04-03T12:45:28.363

Reputation: 50 798

Really? Well at least I got my language known. – caird coinheringaahing – 2017-04-05T21:29:59.837

@ThisGuy: You've made some fun languages :) Not terribly useful in general though ;) – Emigna – 2017-04-05T21:30:54.193

Look at the 2nd paragraph

– caird coinheringaahing – 2017-04-05T21:33:56.450

9

JavaScript (ES7), Neil

_26_=>_26_**6.25**.5

The hard part, of course, was figuring out what to do with all the extra characters. (And also not posting this solution in the wrong thread, like I accidentally did at first. Oopsie...)

Ilmari Karonen

Posted 2017-04-03T12:45:28.363

Reputation: 19 513

1@SethWhite: I had to use all the characters that Neil used in his scrambled code, otherwise this wouldn't have been a valid crack. – Ilmari Karonen – 2017-04-04T17:39:16.577

How does this work? – Arjun – 2017-04-05T07:30:29.337

@Arjun _26_=> defines an anonymous function taking one parameter called _26_ (variables may start with an underscore but not a number). Then the remainder is just using ** as Math.pow() to raise the input to the power of 2.5 (6.25 power 0.5). – Joe – 2017-04-05T09:24:13.140

Ah! I was thinking that _26_ was something ES7 specific. Didn't know that variables can be in this form too! (I have never seen a variable without an alphabet). That was a very clever approach by @Neil. And you were very clever too in cracking it! Have your well-deserved +1! :) – Arjun – 2017-04-05T10:01:13.243

6

Python, 15 bytes, Mr. Xcoder

lambda x:x**2.5

Pretty simple. Just takes x and raises it to the 2.5th power.

user41805

Posted 2017-04-03T12:45:28.363

Reputation: 16 320

6

OCaml, 13 bytes, shooqie

fun f->f**2.5

Try it online!

Dada

Posted 2017-04-03T12:45:28.363

Reputation: 8 279

I was posting it right now! Cannot believe it! Good job! – Mr. Xcoder – 2017-04-03T17:39:39.623

4

C++ (gcc), 100 bytes, Mr. Xcoder

#include<math.h>
#include"iostream"
using namespace std;int main(){float n;cin>>n;cout<<pow(n,2.5);}

Try it online!

fergusq

Posted 2017-04-03T12:45:28.363

Reputation: 4 867

Well done! Please edit the answer you crack, because I cannot do it now! – Mr. Xcoder – 2017-04-03T17:15:24.153

An anonymous user suggested an edit to save 8 bytes by removing the using and just doing int main(){float n;std::cin>>n;std::cout<<pow(n,2.5);} – Martin Ender – 2017-04-03T20:27:10.830

Save another byte #including <cmath> instead of math.h.:) – zyndor – 2017-05-04T05:18:18.407

4

Haskell, Leo

x=exp.(2.5*).log

A pointfree function named x. Usage: x 4 -> 32.0

nimi

Posted 2017-04-03T12:45:28.363

Reputation: 34 639

4

Inform 7, corvus_192

Cool, an Inform7 entry. :) I just had to give this one a try.

I'm pretty sure this is the intended solution:

R is a room.

To f (n - number): say "[n * n * real square root of n]".

Note that this solution only works if compiled with the Glulx back-end, due to the use of the real square root of function.


BTW, the double quotes and square brackets are actually unnecessary; just say n * n * real square root of n would work just as well. The periods at the end of the commands could be omitted, too; or we could keep the first period and get rid of the newlines instead. Other parts of the code we could trim away include the article "a" before "room" and the spaces before the parentheses and after the colon. Fortunately, since we've got a spare pair of brackets, we can always use them to comment out all these extra characters. ;) So this is a valid solution, too:

R is room.To f(n - number):say n * n * real square root of n[
" a . "
]

To test this solution interactively, it's convenient to append something like the following test harness to the code:

Effing is an action applying to one number.
Understand "f [number]" as effing.
Carry out effing: f the number understood.

After compiling and running the program, you can type e.g. f 4. f 6. f 9. f 25 at the > prompt and receive something like the following output:

Welcome
An Interactive Fiction
Release 1 / Serial number 170404 / Inform 7 build 6L38 (I6/v6.33 lib 6/12N) SD

R

>f 4. f 6. f 9. f 25
32.0
88.18164
243.0
3125.0
>

BTW, I just noticed that Inform (or presumably, rather, Glulx) rounds the last decimal place of f 6 wrong: the correct value is much closer to 88.18163 than to 88.18164. Fortunately, I don't think this affects the correctness of the solution(s), especially since the challenge specified "any rounding mechanism of your choice". :)

Ilmari Karonen

Posted 2017-04-03T12:45:28.363

Reputation: 19 513

I'm sure I found an Inform 7 fiddle a while ago, but I can't find it when I search. Do you know if there is an online interpreter anywhere? – Flounderer – 2017-04-03T23:19:46.833

@Flounderer: I don't really know of any. There are certainly online (even JS-based) players for the Glulx / Z-machine bytecode produced by the Inform 7 compiler, but I'm not aware of anything that would directly take plain Inform 7 source code and compile and run it online. The compiler / IDE is pretty easy to install, though; on Ubuntu Linux, it's as easy as apt-get install gnome-inform7. – Ilmari Karonen – 2017-04-03T23:37:26.320

4

Mathematica, Greg Martin

f[y_]:=With[{x=
    #&@@{#(#)#^(1/(1+1))&@y,#&@@@{1^(1),-1}}
},Print[#,".",IntegerString[Round@#2,10,3]]&@@QuotientRemainder[1000x,1000]]

Thanks for leaving the rounding stuff intact!

Explanation: #(#)#^(1/(1+1))&@y does the main work of multiplying y squared, aka y(y), and y's square root, y^(1/(1+1)). The #&@@@{1^(1),-1} bit is just junk to use up the other letters, and #&@@ picks out the useful bit from the junk.

Not a tree

Posted 2017-04-03T12:45:28.363

Reputation: 3 106

4

MATL, 12 bytes, Luis Mendo

10'U&+:'n/^P

Calculate 10/4 = 2.5 with 4 coming from string length. Use this as an exponent. P is a no-op here.

tehtmi

Posted 2017-04-03T12:45:28.363

Reputation: 446

4

Python 3, 44 bytes, Kyle Gullion

Those *s were quite misleading. Very clever!

lambda i:i**(lambda o,r:o/r)(*map(ord,'i*'))

Due to the quite limited character set I would be very surprised if there were any other valid solutions beyond trivial renaming or reordering of arguments.

KSab

Posted 2017-04-03T12:45:28.363

Reputation: 5 984

You got me, nicely done! – Kyle G – 2017-04-12T14:58:15.937

3

R, Steadybox

y<-function(p)(p^(1/2)*p^2);

seems to be an anagram of funny(p1)-tio(^*^)/pc(2)<p2;

Flounderer

Posted 2017-04-03T12:45:28.363

Reputation: 596

3

Python 2, 60 bytes, Anthony Pham

print    (input()**(5.0/(2*5554448893999/5554448893840))-0)

Based on discarding characters through Python 2's float division (the default for / between integers).

notjagan

Posted 2017-04-03T12:45:28.363

Reputation: 4 011

3

C, 50 bytes, Dave

double b(float \ufa2d){return pow(\ufa2d,25e-1);%>

Try it online!

This requires -lm compiler flag, but I don't know how it would be possible to solve this without it.

fergusq

Posted 2017-04-03T12:45:28.363

Reputation: 4 867

correct, and almost exactly what I had (variable was named \uad2f on mine). Well done; I thought I'd left enough red-herrings in there to keep people busy a lot longer! Also the -lm flag wasn't needed for me using Clang (I'd have mentioned it!) but you're correct that strictly speaking it's required. – Dave – 2017-04-04T11:59:09.227

3

R, Flounderer

This is a crack of the 33 bytes solution of @Flounderer

scan()^(floor(pi)-1/2)-sin(7*0e1)

Usage:

> scan()^(floor(pi)-1/2)-sin(7*0e1)
1: 4
2: 
Read 1 item
[1] 32
> scan()^(floor(pi)-1/2)-sin(7*0e1)
1: 6
2: 
Read 1 item
[1] 88.18163
> scan()^(floor(pi)-1/2)-sin(7*0e1)
1: 9
2: 
Read 1 item
[1] 243
> scan()^(floor(pi)-1/2)-sin(7*0e1)
1: 25
2: 
Read 1 item
[1] 3125

plannapus

Posted 2017-04-03T12:45:28.363

Reputation: 8 610

Yes, this is not the intended solution which involved sin(pi), but unfortunately it does work! +1 – Flounderer – 2017-04-04T21:13:42.463

It was scan()^(-floor(-sin(pi)*2e17)/10) – Flounderer – 2017-04-05T21:38:09.397

3

EXCEL, 26 Bytes pajonk

=SQRT(A1)*A1^2/1/ISNA(IP2)

A1 as input IP2 contain a second input with a #N/A Error in this case ISNA(IP2) belongs to 1

For an additional () we can do this

=SQRT(A1)*A1^2/ISNA(PI(1/2))

Jörg Hülsermann

Posted 2017-04-03T12:45:28.363

Reputation: 13 026

Is second input allowed in such challenge? – pajonk – 2017-04-05T15:11:49.500

@pajonk The rules say "You can take input in any standard way" so I have assume that you make this trick with a second input – Jörg Hülsermann – 2017-04-05T15:30:13.007

@pajonk I have improve my post it could been that you have make a little mistake – Jörg Hülsermann – 2017-04-05T16:12:29.560

The standard way for taking one number is (I think) taking one input. In my opinion the second input would be unfair and against the rules. PS There's no mistake in number of brackets. – pajonk – 2017-04-06T18:59:46.010

@pajonk I can not use combinations with SIN and PI cause there are not enough brackets. =SQRT(A1)*A1^2/SIN(PI()/2) If you set the #NA Error through formating or something else I would see it as additional second input. SQRT and ISNA are the only two functions that make a little sense. But please ask the man who had developed the question – Jörg Hülsermann – 2017-04-06T20:42:23.440

3

RProgN 2, ATaco

]2^\š*

Apparently StackExchange needs extra characters, so here you go.

notjagan

Posted 2017-04-03T12:45:28.363

Reputation: 4 011

My solution was ]š\2^*, but they both work the same way. – ATaco – 2017-04-04T23:21:21.837

3

HODOR, 198, This Guy

Walder
Hodor?!
hodor.
Hodor, Hodor Hodor Hodor Hodor Hodor Hodor Hodor, Hodor Hodor,
hodor,
Hodor, Hodor Hodor Hodor Hodor Hodor Hodor, Hodor Hodor,
Hodor, Hodor Hodor Hodor, hodor!,
HODOR!!
HODOR!!!

Explanation:

Start
read input into accumulator
copy accumulator to storage
Do math, option 7(nth root), n=2
swap storage and accumulator
Do math, option 6(nth power), n=2
Do math, option 3(times), storage
output accumulator as a number
end

note: I had to make some modifications to the get interpreter to run on my machine (the one you have posted doesn't seem to accept lowercase h, among some other things)

Also, I don't seem to have enough rep to comment, so if someone could let @This Guy know, I would be grateful

I think this fixed the error, the code now starts with Walder instead of Wylis, which adds the extra byte

wwj

Posted 2017-04-03T12:45:28.363

Reputation: 81

Almost there. Had to change a mistake in my code so yours ins't quite right. – caird coinheringaahing – 2017-04-05T14:10:56.190

fixed the start command – wwj – 2017-04-05T14:24:27.530

Though that you had it but you went for a different method than me that uses the same number of bytes. Your answer would do what you wanted it to do but it isn't the same as mine. Also I had to change the name because of this so I made an edit to your posts.

– caird coinheringaahing – 2017-04-05T14:26:59.080

for clarification, does this still count as a crack, or do I need to match up exactly? – wwj – 2017-04-05T14:51:09.523

I'm not exactly sure. I'm going to ask in the comments. +1 your solution is making me think really hard! – caird coinheringaahing – 2017-04-05T14:52:10.300

I'm just going to give you it given that they;re basically the same. Can I edit yours to add my original code? – caird coinheringaahing – 2017-04-05T15:09:16.467

@ThisGuy: The crack is valid as long as the exact same characters are used (it is an anagram of the original). Doesn't matter if it is the same as the original. – Emigna – 2017-04-05T15:10:04.100

@Emigna Well I've still got NO!

– caird coinheringaahing – 2017-04-05T15:11:44.677

3

C#, 172 bytes, raznagul

Hardest part was figuring out what to do with all the leftovers.

using System;using S=System.Console;class PMabddellorttuuv{static void Main(){S.Write(Math.Pow(double.Parse(S.ReadLine()),2.5));Func<double> o;int q=1,M=q*2,b,e;q*=(q*M);}}

SLuck49

Posted 2017-04-03T12:45:28.363

Reputation: 901

Nice! I got stuck on the leftovers as well. Didn't think to add them to the class name, doh!. Good job! – Emigna – 2017-04-05T15:07:38.303

+1 Not what I had intended, but very nice solution. ;) – raznagul – 2017-04-05T15:16:41.370

3

Python 3.6, 64 bytes, Mr. Xcoder

php38af4r2aoot2srm0itpfpmm0726991i=     (lambda x:x**2.5*1*1/1);

Maybe not what was intended, but works ;)

$ python3
Python 3.6.1 (default, Apr  4 2017, 09:36:47) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> php38af4r2aoot2srm0itpfpmm0726991i=     (lambda x:x**2.5*1*1/1);
>>> php38af4r2aoot2srm0itpfpmm0726991i(6)
88.18163074019441
>>> php38af4r2aoot2srm0itpfpmm0726991i(4)
32.0
>>> php38af4r2aoot2srm0itpfpmm0726991i(25)
3125.0

Not enough rep to comment on the cops' thread's answer yet, sorry... Would appreciate if someone could do it for me, thanks!

user4867444

Posted 2017-04-03T12:45:28.363

Reputation: 275

@Mr. Xcoder , as said above, can't comment on your post in the cops' thread, sorry about that :) – user4867444 – 2017-04-05T23:58:24.917

Came to post a similar solution from math import pi as pp0012223467899;f=lambda x:x**2.5*1*(1)/1 just to see I've been beaten to the punch. I've added a link to this post on the cops thread for you. – Kyle G – 2017-04-06T01:43:00.330

3

Röda, 28 bytes, fergusq

f(n){push n^0.5,n^2|product}

tehtmi

Posted 2017-04-03T12:45:28.363

Reputation: 446

3

Python 2.7, Koishore Roy

s=e=x=y=input()**0.5
print'%.3f'%(y**(5.0))

ovs

Posted 2017-04-03T12:45:28.363

Reputation: 21 408

Or y=x=e=s, both work :)) Good job anyways! – Mr. Xcoder – 2017-04-08T14:46:34.897

Good job. :P Now I need to work on a new code. Darn! – Koishore Roy – 2017-04-09T08:47:00.620

3

R, Flounderer

This is a crack of @Flounderer's 31-byte solution:

`[.`=function(`]`)`]`^`[`(lh,9)

Ok that was a tough one. It creates a function called `[.`. The argument to the function is called `]` which is elevated to power 2.5 by using the 9th element of the built-in time-serie lh ("a regular time series giving the luteinizing hormone in blood samples at 10 mins intervals from a human female, 48 samples." that is used as example in one of R's base packages). lh[9] is here on top of it replaced by its equivalent `[`(lh, 9). De-obfuscated by substituting f for the function name and n for the argument name, the function then becomes f=function(n)n^lh[9].

Usage:

> `[.`=function(`]`)`]`^`[`(lh,9)
> `[.`(4)
[1] 32
> `[.`(6)
[1] 88.18163
> `[.`(9)
[1] 243
> `[.`(25)
[1] 3125

plannapus

Posted 2017-04-03T12:45:28.363

Reputation: 8 610

2

Python 2, 44 bytes, Anthony Pham

print int(raw_input())**(0+000000000000.5*5)

Takes input from raw_input, converts to int and raises to power 2.5

fəˈnɛtɪk

Posted 2017-04-03T12:45:28.363

Reputation: 4 166

2

JavaScript, fəˈnɛtɪk

n=>n**("ggggg".length*2**(-"g".length))// ""((((((()))))))***,-...;;=====>Seeeeegggghhhhhhhhhilllnnnnnnorrrsstttttttttttu{}

Gets 5/2 through 5 times 2 to the negative first power, where 5 and 1 were received from the length of strings. Took the easy way out in a sense by commenting out the extraneous characters.

notjagan

Posted 2017-04-03T12:45:28.363

Reputation: 4 011

2

C#, 112 bytes, Jan Ivan

using System;class P{static void Main(){var b=Math.Pow(double.Parse(Console.ReadLine()),2.5);Console.Write(b);}}

Emigna

Posted 2017-04-03T12:45:28.363

Reputation: 50 798

2

Fireball, 8 bytes, Okx

♥²♥1Z/^*

Explanation:

♥²♥1Z/^*
♥²       Push first input squared.
  ♥      Push first input again.
   1Z/   Push 1/2
      ^  First input to the 1/2th
       * Multiply square and root

Not sure if it works. I have currently no java on my laptop. :(

Roman Gräf

Posted 2017-04-03T12:45:28.363

Reputation: 2 915

I don't think that will work. Easy fix though, so I'll give you the answer. You just need to swap the Z1 into 1Z. – Okx – 2017-04-04T11:21:58.120

I was sure I did a mistake there. Updated. – Roman Gräf – 2017-04-04T11:22:53.673

2

05AB1E, 47 bytes, Okx

).2555BFHIJJKKKPQRS``„cg…ghi…lsw…x}T…Áöž«‚¹n¹t*

Try it online!

Emigna

Posted 2017-04-03T12:45:28.363

Reputation: 50 798

Ah, I knew there would be a workaround the method I used to 'secure' the code. Well done! – Okx – 2017-04-04T11:21:14.527

@Okx: Yeah, 05AB1E is very tricky to pad with extra code without making it bypassable. – Emigna – 2017-04-04T11:27:34.207

I'll see if I can make you a trickier one ;) – Okx – 2017-04-04T11:29:52.187

@Okx: Looking forward to it :) I have an idea as well that I may try to implement after work ;) – Emigna – 2017-04-04T11:31:51.617

2

CJam, 8 bytes, Roman Gräf

My First ever CJam answer.
CnR are great for testing new languages :)

ldYYW#+#

Try it online!

Explanation

ld         % double(input)
       #   %              ^
  Y        %               (2
      +    %                 +
   Y       %                  2
     #     %                   ^
    W      %                    -1)

Emigna

Posted 2017-04-03T12:45:28.363

Reputation: 50 798

2

Haskell, 64 bytes, @nimi

product.(<$>(($(succ.cos$0))<$>[(flip<$>flip)id$id,recip])).(**)

Try it online! That was a fun one. I first found product.(<$>(($succ(cos$0))<$>[id,recip])).(**) which behaves correctly and than had to fit flip flip <$> () $ id . somewhere into it.

Laikoni

Posted 2017-04-03T12:45:28.363

Reputation: 23 676

2

R, steadybox

a222=function(s)(s**0.5)*s**2**1

Usage:

> a222=function(s)(s**0.5)*s**2**1
> a222(4)
[1] 32
> a222(6)
[1] 88.18163
> a222(9)
[1] 243
> a222(25)
[1] 3125

plannapus

Posted 2017-04-03T12:45:28.363

Reputation: 8 610

Original: a=function(s)s**2*s**(0.125*2*2) – Steadybox – 2017-04-04T14:47:14.103

2

05AB1E, 22 bytes, P. Knops

n¹t*qA9¥="'?:@->%#[{!.

Try it online!

Explanation

n      # square of input
   *   # times
 ¹t    # square root of input
    q  # end program

The rest of the operations never get executed.
We could have done it without the q as well by having ? after the calculation and escaping the equality sign for example with '=.

Emigna

Posted 2017-04-03T12:45:28.363

Reputation: 50 798

1Was just doing it for fun :D – P. Knops – 2017-04-04T18:12:35.697

@P.Knops: That's the best reason :) – Emigna – 2017-04-04T18:56:28.217

2

HODOR, 171 bytes, wwj

Walder
Hodor 
Hodor 
Hodor 
Hodor 
Hodor
Hodor, Hodor Hodor Hodor Hodor, Hodor Hodor,
hodor.
Hodor.
Hodor?!
Hodor, Hodor Hodor Hodor Hodor Hodor Hodor, hodor!,
HODOR!!
HODOR!!!

Explanation

  • Increment accumulator to 5
  • Divide accumulator by 2
  • Save a copy of accumulator value
  • Set accumulator to 0
  • Read input
  • Raise input to the value of the stored copy (2.5)
  • Output as number

Emigna

Posted 2017-04-03T12:45:28.363

Reputation: 50 798

back to the drawing board – wwj – 2017-04-05T15:07:28.043

2

JavaScript, 39 bytes, SLuck49

x=>(l=Math).cbrt(l.exp(l.log(x)*7.5))

or similarly

x=>(l=Math).exp(l.log(l.cbrt(x))*7.5)

Test:

alert((

x=>(l=Math).cbrt(l.exp(l.log(x)*7.5))

)(prompt()));

GOTO 0

Posted 2017-04-03T12:45:28.363

Reputation: 752

2

C, 115 bytes, user4867444

New solution that works for 0.

o(double n){double l=1;;for(double o=0.;o<=8*8*2e3&&(long)o+n*((long)2*3>>1);o++)l=(l+n/l)/2;printf("%.3f",n*n*l);}

Old solution that doesn't work for 0:

o(double n){double l=n;;for(double o=1.0;o<=8*8*2e+3&&(long)o*((long)2*3>>1);o++)l=(l+n/l)/2;printf("%.3f",n*n*l);}

Applying Newton's method (for square root) a very large fixed number of times seems to give adequate precision for numbers in the required range. I did some character wasting in the first two for loop clauses.

tehtmi

Posted 2017-04-03T12:45:28.363

Reputation: 446

Close, but not quite, as it returns nan for 0 (not sure we care about that case, asked the OP in a comment) – user4867444 – 2017-04-06T15:37:04.273

As specified by the OP, our programs must return 0 for 0, so I'm afraid your solution doesn't work. – user4867444 – 2017-04-06T16:59:45.030

@user4867444: Sorry, I didn't understand that it must work for 0. I've provided a modified solution that should work for 0. – tehtmi – 2017-04-06T17:48:34.320

1the original solution was o(double n){long o=2.303e18+(*(long*)&n>>1);double l=*(double*)&o;for(o=2;o++<8;)l=(l+n/l)/2;printf("%.3f",l*n*n);}, which uses a nice magic constant to only do a few Newton iterations as opposed to thousands - but great job! – user4867444 – 2017-04-06T18:33:16.937

2

05AB1E, 22 bytes, Emigna

蛹DDLÏ_zTnF©¹®/+;}¹DP

Most probably not what was intended, but works ;)

Everything before T is just byte wasting (but which leaves the stack empty), then it does a 100 Newton iterations, which yields a good enough approximation of the square root, then pushes the input twice and returns the product of the whole stack, thus giving the desired output.

Example runs:

$ echo 0 | ./05AB1E.py -e '蛹DDLÏ_zTnF©¹®/+;}¹DP'
0.0
$ echo 4 | ./05AB1E.py -e '蛹DDLÏ_zTnF©¹®/+;}¹DP'
32.0
$ echo 6 | ./05AB1E.py -e '蛹DDLÏ_zTnF©¹®/+;}¹DP'
88.18163074019441
$ echo 25 | ./05AB1E.py -e '蛹DDLÏ_zTnF©¹®/+;}¹DP'
3125.0
$ echo 7131 | ./05AB1E.py -e '蛹DDLÏ_zTnF©¹®/+;}¹DP'
4294138928.896773

user4867444

Posted 2017-04-03T12:45:28.363

Reputation: 275

Nice one! Didn't think of that :P – Emigna – 2017-04-07T16:30:19.690

2

05AB1E, 15 bytes, user4867444

DMžDFD¹s/+;}01P

Try it online!

Explanation

D                 # duplicate input
 M                # push the largest value on the stack (the input)
  žDF             # 4096 times do:
     D            # current value
         +        # added to
      ¹s/         # input divided by current value
          ;       # divide sum by 2
           }      # end loop
            01    # push 1
              P   # product of the stack

Emigna

Posted 2017-04-03T12:45:28.363

Reputation: 50 798

2

05AB1E, 23 bytes, user4867444

$DDžHGD¹s/+;}0@rrzz2+\P

Try it online!

Explanation

$                        # push 1 and input
 DD                      # duplicate the input twice
   žHG                   # 65536 times do:
      D                  # duplicate current value
       ¹s/               # divide input by current value
          +              # add result of division to current value
           ;             # divide by 2
            }            # end loop
             0@          # get the bottom value of the stack (the 1)
               rr        # reverse the stack twice (no-op)
                 zz      # calculate 1/(1/1), a no-op
                   2+    # add 2
                     \   # discard top of stack (the 3)
                      P  # product of stack

Emigna

Posted 2017-04-03T12:45:28.363

Reputation: 50 798

2

JavaScript, SIGSEGV

x=>x**(25*10**-1)

Try it online!

Emigna

Posted 2017-04-03T12:45:28.363

Reputation: 50 798

You got it! Kudos for you ;) – Matthew Roh – 2017-04-12T11:32:37.437

1

Python - SparklePony

import math
f=lambda x:x*x*math.sqrt(x)

Mr. Xcoder

Posted 2017-04-03T12:45:28.363

Reputation: 39 774

That was very fast! – Comrade SparklePony – 2017-04-03T18:00:55.143

Thanks @SparklePony. It was very similar to mine, done it right away – Mr. Xcoder – 2017-04-03T18:01:18.270

@SparklePony please accept the edit... – Mr. Xcoder – 2017-04-03T18:01:46.813

I think I have done it... first time accepting an edit! – Comrade SparklePony – 2017-04-03T19:34:26.753

1

Scala, corvus_192

d=>math.pow(d,5/2d)

Try it here!

Simple lambda expression

math junkie

Posted 2017-04-03T12:45:28.363

Reputation: 2 490

1

05AB1E - P. Knops

t¹n*

Was quite easy :)

Mr. Xcoder

Posted 2017-04-03T12:45:28.363

Reputation: 39 774

1

C, Steadybox

float q(float b){return(b-b>0.*4*1/1)-sqrtf(b)*pow(b,2)*-1;}

Not sure what the original did; I had to discard a lot of random operators and numbers, but once the available words were clear it wasn't too hard to piece together the general idea.

Dave

Posted 2017-04-03T12:45:28.363

Reputation: 7 519

Oops; noticed I'd accidentally included an extra space than the original; fixed. – Dave – 2017-04-03T20:15:05.070

Here's the original function: float q(float b){return-1*pow(b,(b>-12)/sqrt(4.0f))*b*b*-1;} – Steadybox – 2017-04-03T20:46:18.267

1

R, Flounderer

scan()**mean(1:4.5)

Try it online!

Steadybox

Posted 2017-04-03T12:45:28.363

Reputation: 15 798

1

Python 3.6, c..

f=lambda x:x**2.5or'1*77*8+8/5/(((aafothipie.xml)))'

Try it online!

Stuffs all the unneeded characters into a string after the or. Since x**2.5 is nonzero and so truthy, the part after the or isn't evaluated. Any syntactically valid expression would be OK here.

Python parses 2.5 and or as separate tokens in 2.5or, though the syntax highlighter for the code doesn't recognize this.

xnor

Posted 2017-04-03T12:45:28.363

Reputation: 115 687

I think you meant x**2.5? Damn Python, I'm doing the next one without strings. – c.. – 2017-04-04T05:25:00.467

@c.. Yes, 2.5, thanks. – xnor – 2017-04-04T05:27:26.890

1

Ruby, G B

->a{eval''<<97<<42<<42<<50<<46<<53}

xsot

Posted 2017-04-03T12:45:28.363

Reputation: 5 069

Nice, I was expecting that, maybe not so fast. :-) – G B – 2017-04-04T08:13:03.710

1

C#, 135 bytes, Jan Ivan

This was a lot of fun, I particularly liked the use of using static.

using System;using static System.Math;class P{static void Main(){Console.Write(Pow(long.Parse(Console.ReadLine()),1/Round(PI-E,1)));}}

SLuck49

Posted 2017-04-03T12:45:28.363

Reputation: 901

1

JavaScript, SIGSEGV

x=>x**(3.5-+!+[]);

Try it online!

Emigna

Posted 2017-04-03T12:45:28.363

Reputation: 50 798

Well, not the same, but well, that works too. maybeIshouldn'tuseasterisks – Matthew Roh – 2017-04-12T11:56:16.957

@SIGSEGV: I'd be interested to see what the intended version was then :) – Emigna – 2017-04-12T12:03:39.033