| Bytes | Lang | Time | Link |
|---|---|---|---|
| 174 | Python 2 | 250528T011907Z | Lucenapo |
| nan | Vyxal | 211125T065505Z | lyxal |
| 044 | Python 3 | 170412T141530Z | KSab |
| nan | JavaScript | 170412T113042Z | Emigna |
| nan | JavaScript | 170412T115214Z | Emigna |
| nan | R | 170410T082803Z | plannapu |
| nan | Python 2.7 | 170408T144550Z | ovs |
| 135 | C# | 170407T203129Z | SLuck49 |
| 023 | 05AB1E | 170407T165049Z | Emigna |
| 015 | 05AB1E | 170407T163707Z | Emigna |
| 022 | 05AB1E | 170407T161443Z | user4867 |
| 115 | C | 170406T082427Z | tehtmi |
| 012 | MATL | 170406T051544Z | tehtmi |
| 028 | Röda | 170406T041528Z | tehtmi |
| 064 | Python 3.6 | 170405T235728Z | user4867 |
| 041 | NO | 170405T212124Z | Emigna |
| 039 | JavaScript | 170405T192744Z | GOTO 0 |
| 026 | EXCEL | 170404T212631Z | Jör |
| 172 | C# | 170405T150521Z | SLuck49 |
| 171 | HODOR | 170405T150136Z | Emigna |
| nan | HODOR | 170405T010036Z | wwj |
| nan | RProgN 2 | 170404T230139Z | notjagan |
| 008 | CJam | 170404T112533Z | Emigna |
| 022 | 05AB1E | 170404T171050Z | Emigna |
| nan | R | 170404T144952Z | plannapu |
| nan | R | 170404T143657Z | plannapu |
| 064 | Haskell | 170404T141258Z | Laikoni |
| 008 | Fireball | 170404T110236Z | Linnea G |
| 047 | 05AB1E | 170404T111742Z | Emigna |
| 112 | C# | 170404T084749Z | Emigna |
| 050 | C | 170404T083307Z | fergusq |
| nan | Ruby | 170404T075252Z | xsot |
| nan | Python 3.6 | 170404T051113Z | xnor |
| nan | Mathematica | 170404T004950Z | Not a tr |
| nan | JavaScript ES7 | 170403T235746Z | Ilmari K |
| 192 | Inform 7 | 170403T225829Z | Ilmari K |
| 060 | Python 2 | 170403T234028Z | notjagan |
| nan | R | 170403T231507Z | Steadybo |
| nan | JavaScript | 170403T193457Z | notjagan |
| nan | R | 170403T223004Z | Flounder |
| nan | C | 170403T200421Z | Dave |
| nan | 170403T192849Z | Mr. Xcod | |
| nan | Haskell | 170403T191802Z | nimi |
| 192 | Scala | 170403T190652Z | math jun |
| nan | 170403T175932Z | Mr. Xcod | |
| 013 | OCaml | 170403T173835Z | Dada |
| 044 | Python 2 | 170403T173736Z | fəˈnɛtɪk |
| 100 | C++ gcc | 170403T171433Z | fergusq |
| 015 | Python | 170403T161952Z | user4180 |
Python 2, 174 bytes, cracks penalosa
print str(input()**(5. * .5))or ()/22*2444599.9.HHHWWW_______________aaaaabbbcccccccccddddddeeeeeeeeeeeefffgghhhhiiiiiiikkkkkkkkkllllllllmmnnnooooooooprrrrrrrrrrrt.tttuuuuuu;
Vyxal, cracks emanresuA's answer
5|2/en[(`ĖĖ:
Easy. I came up with the solution in the shower that's how easy it is.
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.
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
Python 2.7, Koishore Roy
s=e=x=y=input()**0.5
print'%.3f'%(y**(5.0))
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)));}}
05AB1E, 23 bytes, user4867444
$DDžHGD¹s/+;}0@rrzz2+\P
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
05AB1E, 15 bytes, user4867444
DMžDFD¹s/+;}01P
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
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
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.
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.
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!
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()));
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))
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);}}
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
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
CJam, 8 bytes, Roman Gräf
My First ever CJam answer.
CnR are great for testing new languages :)
ldYYW#+#
Explanation
ld % double(input)
# % ^
Y % (2
+ % +
Y % 2
# % ^
W % -1)
05AB1E, 22 bytes, P. Knops
n¹t*qA9¥="'?:@->%#[{!.
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 '=.
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
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
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.
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. :(
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);}}
C, 50 bytes, Dave
double b(float \ufa2d){return pow(\ufa2d,25e-1);%>
This requires -lm compiler flag, but I don't know how it would be possible to solve this without it.
Ruby, G B
->a{eval''<<97<<42<<42<<50<<46<<53}
Python 3.6, c..
f=lambda x:x**2.5or'1*77*8+8/5/(((aafothipie.xml)))'
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.
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.
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...)
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". :)
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).
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.
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.
Python - SparklePony
import math
f=lambda x:x*x*math.sqrt(x)
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
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);}
Python, 15 bytes, Mr. Xcoder
lambda x:x**2.5
Pretty simple. Just takes x and raises it to the 2.5th power.