JavaScript (ES6), 63 bytes, SLuck49
Original:
x=>eval(atob`eCp4KzEvLyAgfXBModLS4TvEn4wp1iys9YRRKC85KLIhNMC=`)
Crack:
x=>eval(atob`CgpNYXRoLnBvdyh4LTEsMC41KSAvLw4589CEIKKMRefipyz=`)
The base64 code above decodes to:
Math.pow(x-1,0.5) //...
where the ...
stands for a bunch of random garbage that is ignored by the JS interpreter, since it's in a comment.
I found this solution by trial and error. In the end, the only really tricky part were the two newlines at the beginning of the code, needed to make the rest line up properly and to get the M
in Math
to base64-encode into something that was available in the original character set. I first tried spaces, but " M"
base64-encodes into "ICBN"
and I needed the only available B
to encode ".po"
later in the code. "0+M"
, "1*M"
, "1?M"
or any other similar no-op prefixes I could think of didn't work either, but newlines did.
I suspect this may not be exactly the intended solution, but whatever — it works. :)
Demo:
var f = x=>eval(atob`eCp4KzEvLyAgfXBModLS4TvEn4wp1iys9YRRKC85KLIhNMC=`)
var g = x=>eval(atob`CgpNYXRoLnBvdyh4LTEsMC41KSAvLw4589CEIKKMRefipyz=`)
for (var i = -0; i <= 10; i++) console.log(i, '->', f(i), '->', g(f(i)))
How do I "notify the original answerer"? – G B – 2017-01-16T15:24:34.900
Left a comment linking your answer on the original – Sefa – 2017-01-16T15:25:28.503
You should drop the
f=
at the start of your code since its not needed and not part of the original function – 0 ' – 2017-01-16T15:26:04.747Done, I just copy-pasted it too quickly. – G B – 2017-01-16T15:26:41.207
16Here I am actually brute forcing a solution (and even assuming one exists) and you just sidestep the entire problem! +1 – orlp – 2017-01-16T15:26:58.210
Very well done :) – Lynn – 2017-01-16T15:31:19.943
I had thought of adding numbers to be part of the variable, but I still decided there were too many combinations for me to look into it. – mbomb007 – 2017-01-16T18:57:55.243
I moved all of them and was left with 1, 7 and 9, then started thinking of possible connections. – G B – 2017-01-16T19:02:50.517