Cops - square times square root

37

4

Note: This is the cops' thread, where one should post the scrambled code. Here is the robbers' thread where the cracked source should be posted and linked to the cop's answer.


Task: Write the shortest safe program which multiplies the square root of an integer n by the square of n

This is , so the rules are:

  • In your answer, post a scrambled version of your source code (the characters should be written in any order). The scrambled version should not work!
  • You can take input in any standard way, the same goes for output. Hardcoding is forbidden
  • After the code is cracked by the robbers (if this happens), you must mention that your code has been cracked in your title and add a spoiler to your answer's body with your exact code
  • The same applies to safe answers (mention that it's safe and add the spoiler)
  • The code is considered safe if nobody has cracked it in 5 days after posting it and you can optionally specify that in the title
  • You must specify your programming language
  • You should specify your byte count
  • You must state the rounding mechanism in your answer (see below)

You can assume that the result is lower than 232 and n is always positive. If the result is an integer, you must return the exact value with or without a decimal point; otherwise the minimum decimal precision will be 3 decimal places with any rounding mechanism of your choice, but can include more. You must state the rounding mechanism in your answer. You are not allowed to return as fractions (numerator, denominator pairs - sorry, Bash!)

Examples:

In -> Out

4 -> 32.0 (or 32)
6 -> 88.18163074019441 (or 88.182 following the rules above)
9 -> 243.0
25 -> 3125.0

The shortest safe answer by the end of April will be considered the winner.

Mr. Xcoder

Posted 2017-04-03T12:47:02.247

Reputation: 39 774

2Related. (Same CnR rules, different task.) – Martin Ender – 2017-04-03T12:57:21.840

2@MartinEnder If the task is the only thing differing, then isn't it a duplicate? – Nathan Merrill – 2017-04-03T14:48:24.860

1@NathanMerrill I don't know, I don't think we have any established duplicate guidelines for cops and robbers challenge, but if I ask a new [tag:code-golf] challenge, where the "only" thing that's different from a previous code golf is the task, it's usually not considered a duplicate. ;) (That said, I agree that CnRs are probably more interesting if we change up the CnR-part of the challenge, not the underlying task.) – Martin Ender – 2017-04-03T14:50:32.230

@MartinEnder I personally think that the answers from the other challenge could be trivially modified to fit this challenge. It has nothing to do with the tag IMO – Nathan Merrill – 2017-04-03T14:53:55.353

@NathanMerrill I don't know about others, but none of my four answers could be reasonably reused for this challenge. – Martin Ender – 2017-04-03T14:56:21.300

1Good luck everyone! I am really glad that you have decided to reopen this. Looking forward to see interesting answers! – Mr. Xcoder – 2017-04-03T15:23:43.713

Is it okay if for large values there are rounding errors due to the inaccuracy of floating point numbers at that size? – fəˈnɛtɪk – 2017-04-03T15:56:11.860

@fəˈnɛtɪk yes, of course. The decimal precision really shouldn't matter that much for large values – Mr. Xcoder – 2017-04-03T15:57:03.023

Max expected input is 7131.55. It might be helpful to have that in the post. – fəˈnɛtɪk – 2017-04-03T16:17:48.217

I mentioned that the result is lower than 2^32, so I think it is not necessary @fəˈnɛtɪk – Mr. Xcoder – 2017-04-03T16:18:42.040

2I had written my code to work for an input up to 2^32... Which is why I asked about rounding errors, got rather off the mark at that point – fəˈnɛtɪk – 2017-04-03T16:19:16.857

Do the robbers need to use the same rounding method as the cops? – Leo – 2017-04-03T16:46:25.840

Not necessarily, as long as it works @Leo – Mr. Xcoder – 2017-04-03T16:47:43.953

Can languages that do not natively support decimal numbers (Brainfuck, as an example) support only Integer output? – ATaco – 2017-04-04T01:33:20.773

Well, that's kind of unfair @ATaco, but I will accept that if you specify in your answer. – Mr. Xcoder – 2017-04-04T04:30:25.480

Why is this tagged [tag:code-golf]? – Roman Gräf – 2017-04-04T11:15:28.677

@RomanGräf because the shortest safe answer wins – Mr. Xcoder – 2017-04-04T11:16:32.953

Oh, I only read the winning condition of the robbers thread. – Roman Gräf – 2017-04-04T11:20:16.033

@Mr.Xcoder: can the input be 0? – user4867444 – 2017-04-06T15:36:40.673

Yes, it can. The corresponding output is 0 – Mr. Xcoder – 2017-04-06T15:37:32.117

@Mr.Xcoder: The rules already say "you can assume n is always positive" which to me means that 0 does not need to be handled. Are you sure you want to change it? – tehtmi – 2017-04-06T17:39:30.563

0 is considered positive for this challenge @tehtmi – Mr. Xcoder – 2017-04-06T17:40:38.427

@Mr.Xcoder: is there a constraint on the performance? As in, is it acceptable for an answer to take a somewhat longer time to return? – user4867444 – 2017-04-07T18:21:02.937

@user4867444 On a standard computer, it should not take longer than 15 seconds to execute – Mr. Xcoder – 2017-04-07T18:21:53.117

@Mr.Xcoder OK thanks – user4867444 – 2017-04-07T18:23:41.210

@Mr.Xcoder so no accepted answer? – user4867444 – 2017-05-24T02:07:52.507

Answers

2

05AB1E, 20 bytes - safe

Another totally different approach from my previous answers.

****++/133DDFPTs}¹¹Ð

No rounding.

Example runs

In   -> Out
0    -> 0
4    -> 32.0
6    -> 88.18163074019441
25   -> 3125.0
7131 -> 4294138928.896773

I have no doubt @Emigna is going to crack it in a jiffy, but eh, one has to try! :-D


Solution

D1TFÐ*D¹3*+s3*¹+/*}P

This is using the fact that this sequence:

u_0 = 1, u_{n+1} = u_n * (u_n ^ 2 + 3 x) / (3 u_n ^ 2 + x)

converges to sqrt(x), and cubically fast at that (sorry, didn't find how to format math equations in PCG).

Detailed explanation

D1TFÐ*D¹3*+s3*¹+/*}P
D1                   # Duplicate the input, then push a 1: stack is now [x, x, 1] (where x is the input)
  TF                 # 10 times (enough because of the cubic convergence) do
    Ð                # triplicate u_n
     *               # compute u_n ^ 2
      D              # and duplicate it
       ¹3*+          # compute u_n ^ 2 + 3 x
           s         # switch that last term with the second copy of u_n ^ 2
            3*¹+     # compute 3 u_n ^ 2 + x
                /    # compute the ratio (u_n ^ 2 + 3 x) / (3 u_n ^ 2 + x)
                 *   # compute u_n * (u_n ^ 2 + 3 x) / (3 u_n ^ 2 + x), i.e. u_{n+1}, the next term of the sequence
                  }  # end of the loop
                   P # compute the product of the whole stack, which at that point contains u_10 (a sufficiently good approximation of sqrt(x)), and the 2 copies of the input from the initial D: we get x ^ 2 * sqrt(x)

Try it online!

user4867444

Posted 2017-04-03T12:47:02.247

Reputation: 275

17

Python 3, 44 bytes (cracked)

'**:(((paraboloid / rabid,mad,immoral))):**'

No rounding. Floating point accuracy.

Kyle G

Posted 2017-04-03T12:47:02.247

Reputation: 761

4Come on, this deserves more points, it's so creative! There is symmetry, and all words are real words. – Erik the Outgolfer – 2017-04-08T18:12:40.267

If I didn't make any silly mistakes... Cracked

– KSab – 2017-04-12T14:17:33.313

11

MATL, 12 bytes (cracked by @tehtmi)

'Un&0P'/^:+1

No rounding; uses floating point.

Intended solution (different from that found by @tehtmi):

:&+n10U'P'/^

Explanation

:&+ % Create a matrix of size n × n, where n is implicit input
n % Number of elements. Gives n^2
10U % 10 squared. Gives 100
'P' % 'P' (ASCII code 80)
/ % Divide. Gives 1.25
^ % Power. Implicit display

Luis Mendo

Posted 2017-04-03T12:47:02.247

Reputation: 87 464

1Crack? – tehtmi – 2017-04-06T05:16:23.353

@tehtmi Indeed! Well done! My intended solution was different; I just posted it – Luis Mendo – 2017-04-06T09:20:42.650

10

Röda, 28 bytes (Cracked by @tehtmi)

 (),.025^^cdfhnnnopprstuu{|}

Note the space at the beginning. No rounding, but it uses floating point numbers so precision is limited.

fergusq

Posted 2017-04-03T12:47:02.247

Reputation: 4 867

Is this an anonymous function, or a "full" function? – user41805 – 2017-04-03T16:12:11.110

@KritixiLithos if the cop does not want to give clues, it is not supposed to – Mr. Xcoder – 2017-04-03T16:15:01.567

Cracked? – tehtmi – 2017-04-06T04:16:34.240

10

Perl, 42 bytes (Safe)

There are 41 bytes of code and -p flag (no other flags).

/"/4~~r..rso4r<_$4va=eg1de|i/h0-&$c={}l+"

The result isn't rounded (or rather rounded up to the same point Perl would have round up by doing $_ = (sqrt $_) * ($_ ** 2)).

Solution:

$_=eval".i44<4}{|~"=~s/./chr-10+ord$\&/gre
(without the \ before the & - markdown spoiler seems to dislike $ followed by &)
Try it online!

Explanation:

.i44<4}{|~ is $_**2*sqrt but with every character replaced by the character with its ascii code + 10. (ascii code of $ is 36, so it becomes . whose ascii code is 46, etc.).
The purpose of s/./chr-10+ord$\&/gre is then to undo this transformation: it replaces each character by the character with ascii code 10 lower. (chr-10+ord$\& is probably clearer as chr(ord($\&)-10) where chr returns the character corresponding to an ascii code, and ord returns the ascii code corresponding to a character).
finally, eval evaluates this string, and thus computes the result, which is stored in $_, which is implicitly printed at the end thanks to -p flag.

Dada

Posted 2017-04-03T12:47:02.247

Reputation: 8 279

True. I was trying to edit quickly because I saw 4 reopen votes and hoped to get the question fixed before the 5th was cast. If the question had been left in the sandbox until it was ready, it would have been better for all involved. – Peter Taylor – 2017-04-03T15:57:48.897

@PeterTaylor Sure, no problem, and anyway it was bold so fairly visible (I wasn't blaming anyone, but merely pointing a minor flow (that I corrected right away (introducing typos in the process))). And I couldn't agree more about the sandbox part. – Dada – 2017-04-03T16:04:43.310

can you explain it a bit? – phuclv – 2017-04-05T06:47:30.017

@LưuVĩnhPhúc You mean if I can give you a little bit of help to crack it? mmh... the code starts with $_=. And there is a eval somewhere. (that's not a lot but I feel I can't give you more without giving you too much information) – Dada – 2017-04-07T09:24:21.687

8

Octave, 43 bytes (Safe)

$'()*+,-/23579:[]aelnouv'*,-23:[]lu',-23]',

This is a script that requires input from the command line (it's not a function). It's floating point accuracy (so no rounding).

Solution:

eval(-[5,-2:3,-3:2]+['nlouu*$$',39,']2/7'])

Explanation:

eval( <string> ) % Evaluated the string inside the brackets and executes it
Everything inside the eval call gets evaluated to input('')^2.5

How?

-[5,-2:3,-3:2] % A vector: [-5, 2, 1, 0, -1, -2, -3, 3, 2, 1, 0, -1, -2]
['nlouu**$$',39,']2/7'] % This is a string: nlouu**$ concatenated with the number
. % 39 (ASCII ']'), and ']2/7'. Thus, combined: 'nlouu**$$']2/7'

Adding the first vector to this string will convert it to the integer vector:
[105, 110, 112, 117, 116, 40, 39, 39, 41, 94, 50, 46, 53]

eval implicitly converts this to a string, and these numbers just so happens to be: input('')^2.5

Stewie Griffin

Posted 2017-04-03T12:47:02.247

Reputation: 43 471

1This was hard. Well done! – Luis Mendo – 2017-04-09T02:08:30.467

7

C, 50 bytes (Cracked by fergusq)

%(())   ,-12225;>\\aaabbdddeeefffllnoooprrttuuuuw{

Uses standard IEEE754 rounding. As noted by fergusq's answer, may require -lm depending on your compiler.

Dave

Posted 2017-04-03T12:47:02.247

Reputation: 7 519

Cracked? – fergusq – 2017-04-04T08:33:25.690

@fergusq correct, and almost exactly what I had. Well done; I thought I'd left enough red-herrings in there to keep people busy a lot longer! – Dave – 2017-04-04T11:56:38.037

@Dave Wow, that looks like a syntax error at first. – Erik the Outgolfer – 2017-04-04T17:08:34.070

6

Swift - 64 bytes (Safe)

prot Fdnufi;nooitamunc xetgru(->atl)Ior:n{tFn pg,F(ao.o25t)(w)l}

No rounding, and displays a .0 even if the result is an integer.

Mr. Xcoder

Posted 2017-04-03T12:47:02.247

Reputation: 39 774

6

Mathematica, 131 bytes, non-competing?, cracked

This has been cracked by @lanlock4! However, I still have internet points to bestow on someone who finds the original solution, where all the characters are actually needed....

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

This is intended as a puzzle. Although you may use the above characters however you want, I certainly intend for the answer to follow the form

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

where the first and third lines are just a wrapper to make the rounding and display legal (it writes every output to exactly three decimal places, rounded), and the second line is the scrambled version of the guts of the code. Sample outputs:

6 -> 88.182
9 -> 243.000
9999 -> 9997500187.497

(Mathematica is non-free software, but there is a Wolfram sandbox where it is possible to test modest amounts of code. For example, cutting and pasting the code

f[y_]:=With[{x=
    y^2.5
},Print[#,".",IntegerString[Round@#2,10,3]]&@@QuotientRemainder[1000x,1000]]

defines a function, which you can subsequently call like f@6 or f[9], that does the same thing as the unscrambled version of the code above. So does this really have to be non-competing?)

Greg Martin

Posted 2017-04-03T12:47:02.247

Reputation: 13 940

Cracked it! – Not a tree – 2017-04-04T00:50:55.480

4

C#, 172 bytes (Cracked by SLuck49)

       (((((())))))***,,,,......1225;;;;;;<====>CFLMMMMMPPPRSSSSSWaaaaaaabbbbcccddddddeeeeeeeeeeegghiiiiiiiillllllmmnnnnnnnooooooooqqqqrrrssssssssstttttttttuuuuuuuvvwyy{{}}

This code is a full program.

There are seven space characters at the start.

The input is read form STDIN and printed to STDOUT. The result is in double, no rounding done.

Original Code ungolfed:

using System;
using S = System.Console;

class P
{
    static void Main()
    {
        var t = S.ReadLine();
        double q = int.Parse(t);
        Func<double, double, double> M = Math.Pow;
        S.Write(M(q, 2 * .25) * M(q * q, 1));
    }
}

raznagul

Posted 2017-04-03T12:47:02.247

Reputation: 424

Cracked – SLuck49 – 2017-04-05T15:06:18.983

4

Haskell, 16 bytes (Cracked by @nimi)

()*...25=eglopxx

No particular rounding

Leo

Posted 2017-04-03T12:47:02.247

Reputation: 8 482

4

R, 28 bytes (Cracked by @Flounderer)

funny(p1)-tio(^*^)/pc(2)<p2;

Standard R floating-point accuracy.

Steadybox

Posted 2017-04-03T12:47:02.247

Reputation: 15 798

Is this it? http://codegolf.stackexchange.com/a/115132/26905

– Flounderer – 2017-04-03T22:31:14.957

@Flounderer Yes, it is. – Steadybox – 2017-04-03T23:05:15.447

3

Python 2, 60 Bytes (Cracked by @notjagan)

 3n0)4  5)594p3(p5*5i9t4542)0/*((8(t.84- 90945 u)i*48/95n8r8

No rounding involved. Accurate up to 10 decimal digits.

Anthony Pham

Posted 2017-04-03T12:47:02.247

Reputation: 1 911

Cracked! – notjagan – 2017-04-03T23:43:34.160

3

Inform 7, 71 bytes (Cracked by @Ilmari Karonen)

""()**-..:[]
                 RT
aaaabeeeffilmmnnnnnooooooqrrrrrssstuuy

The code includes 17 spaces and 2 new lines. This is a full Infrom 7 program defining a function that prints the result with a precision of 5 decimal places.

corvus_192

Posted 2017-04-03T12:47:02.247

Reputation: 1 889

Cracked. – Ilmari Karonen – 2017-04-03T22:59:29.943

3

Haskell, 64 bytes, (cracked by Laikoni)

$$$$$$(((((())))))**,...0<<<>>>[]cccccdddeffiiiiilloopppprrsstuu

Standard Haskell floating point operations.

My original version is:

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

nimi

Posted 2017-04-03T12:47:02.247

Reputation: 34 639

Cracked! – Laikoni – 2017-04-04T14:13:19.777

@Laikoni: well done! – nimi – 2017-04-04T14:21:12.487

3

JavaScript (ES7), 20 bytes (Cracked by @IlmariKaronen)

****..22255666=>____

Standard JavaScript precision.

Neil

Posted 2017-04-03T12:47:02.247

Reputation: 95 035

Cracked. (Oops, posted in the wrong thread at first.) – Ilmari Karonen – 2017-04-03T23:56:20.427

Such a clever approach! +1 :) – Arjun – 2017-04-05T10:01:49.053

3

R, 19 bytes (Cracked by @Steadybox)

mensana(4*5*c(.1)):

Standard rounding

R, 33 bytes (Cracked by @plannapus)

(rofl(17)^coins(2*e)/pisan(10))--

R, 31 bytes (Cracked by @plannapus)

h=f`l`u`n`c`t`i`o`n([],[])^(.9)

Flounderer

Posted 2017-04-03T12:47:02.247

Reputation: 596

Cracked the 19-byte answer. – Steadybox – 2017-04-03T23:16:11.753

Cracked the 33-byte solution. – plannapus – 2017-04-04T14:50:11.830

Cracked the 31-byte solution! – plannapus – 2017-04-10T08:28:22.843

3

Python 3.6, 59 bytes

ba(,b5,d' (,a/([m:'-)oa)(bl*aadplma dba](r)d )l*d,:)*m:-mml

No rounding. Floating point accuracy.

Kyle G

Posted 2017-04-03T12:47:02.247

Reputation: 761

Really, 3 lambdas? – Mr. Xcoder – 2017-04-05T15:48:22.413

3

Fourier, 124 119 Bytes

((()))*******--011111<=>>>HHINNNN^^^eeehhhhkkkkmmmmmmmmmmmmmmmmossuuuuuuuuuuuuuuuuu{{{{{{{{{{}}}}}}}}}}~~~~~~~~~~~~~~~~

There are no whitespaces or newline characters.

Square root is rounded to the nearest whole number because Fourier doesn't seem to handle anything other than integers (and since @ATaco got permission, I hope this is ok)

fixed an editing mistake, if you were already cracking this, the previous was functional

Realized that I had misunderstood part of the code, and was using more characters than I needed to

If I missed anything let me know

wwj

Posted 2017-04-03T12:47:02.247

Reputation: 81

3

Octave, 30 bytes (Safe)

(((((())))))**++/:@eeeiiijmsu~

A bit simpler than my first one. Shouldn't be too hard, but it's hopefully a fun puzzle.

Stewie Griffin

Posted 2017-04-03T12:47:02.247

Reputation: 43 471

2No ^? Hmmm... – Luis Mendo – 2017-04-04T09:53:00.700

1Came up with this @(e)(e**((i/(i+i))+~sum(e:j))) but it's only n^1.5...this one's tricky. – Kyle G – 2017-04-09T00:47:01.517

3

Ohm, 11 bytes

M ⁿ¡D¼½;+1I

Use with -c flag. Uses CP-437 encoding.

Roman Gräf

Posted 2017-04-03T12:47:02.247

Reputation: 2 915

I'm sorry, but are you quite sure this is correct? – user4867444 – 2017-04-07T20:51:06.440

Now that no one has cracked it in the imparted time, mind sharing your solution please? I'm very curious :) – user4867444 – 2017-04-10T00:51:50.550

For now, this is the shortest answer considered safe. I will accept it, but if you do not post your original code in 5 days, I will uncheck this, since I am not sure this is possible. EAGER too see your solution – Mr. Xcoder – 2017-05-01T16:23:14.047

I've currently lost my solution. I will try to find it,but its in my old mobile which has a broken plug. – Roman Gräf – 2017-05-01T16:26:22.157

By the way, you generally don't need the -c flag in PPCG submissions unless you explicitly need to use a CP-437 encoded byte stream. – Nick Clifford – 2017-05-01T16:27:57.857

2@RomanGräf try to find your solution, please. Otherwise I will uncheck this... – Mr. Xcoder – 2017-05-06T10:37:34.927

1@RomanGräf : ping? Still very eager to see that solution :) – user4867444 – 2017-05-09T04:41:29.797

@Mr.Xcoder : how much longer are we going to wait for the solution? – user4867444 – 2017-05-12T01:37:15.517

He shared it, but has deleted that comment – Mr. Xcoder – 2017-05-12T06:54:50.697

@Mr.Xcoder : really? That's a shame... I'd very much like to see it, I tried to crack this thing for a good amount of time :) – user4867444 – 2017-05-12T14:44:25.717

@RomanGräf please repost your initial codr – Mr. Xcoder – 2017-05-12T15:15:32.493

@Mr.Xcoder : I must say it makes me a little sad that the accepted solution doesn't even bother giving its original code. One could have just posted some random short string and "won". Not very respectful of the time spent by the all the other people who played by the rules. – user4867444 – 2017-05-14T18:20:01.913

2

Javascript, 123 bytes, Cracked by notjagan

 """"""((((((((()))))))))********,--.....//2;;======>>Seeeeeeegggggggggggghhhhhhhhhhhilllllnnnnnnnnnnorrrsstttttttttttttu{}

This code is a full function

There is one space character at the very start of the list of characters

The rounding of this answer is the floating point precision for Javascript, accuracy is within 10^-6 for every answer.

Got shorter because the precision didn't need to be maintained quite as high as I thought it did.

I had realized that it would be much easier to solve than I initially had made it but it was already there :P

Initial code:

g=t=>t-(t*t-n)/("le".length*t);e=h=>{n=h*h*h*h*h,s=2**(n.toString("ng".length).length/"th".length);return g(g(g(g(g(s)))))}

Newtons method, applied 5 times from the closest power of 2

fəˈnɛtɪk

Posted 2017-04-03T12:47:02.247

Reputation: 4 166

2

OCaml, 13 bytes (Cracked by @Dada)

2*fn-5f>f*u .

No rounding (within IEEE 754 scope).

shooqie

Posted 2017-04-03T12:47:02.247

Reputation: 5 032

3cracked. – Dada – 2017-04-03T17:38:47.453

2

Excel VBA, 59 bytes (Safe)

?(())*..//11124AAAAFPSW[[]]^acceehiiiiklnnnnoooppqrrstttttu

No particular rounding.
Uses the Immediate Window.

pajonk

Posted 2017-04-03T12:47:02.247

Reputation: 2 480

2

RProgN 2, 6 Bytes (Cracked by @notjagan)

š2]^*\

No rounding, displays many decimal places. Does not display any for an integer solution.

ATaco

Posted 2017-04-03T12:47:02.247

Reputation: 7 898

2Does this really perform n²√n? I can easily get it to calculate n² + √n, but I can't for the life of me see how you got the terms to multiply. – notjagan – 2017-04-04T13:36:28.637

@notjagan me too... have been trying for 2 hours to crack it and nothing works. ATaco are you sure that the source is correct? – Mr. Xcoder – 2017-04-04T18:07:24.220

@Mr.Xcoder Ah, you're quite correct. Sorry for wasting your collective times! Please see the edited source. – ATaco – 2017-04-04T20:51:09.337

Now it makes sense! – Mr. Xcoder – 2017-04-04T20:52:00.223

A bit late because I was busy, but cracked.

– notjagan – 2017-04-04T23:03:02.253

2

Octave, 42 bytes (Safe)

((((()))))+,,,-//01111111@[]^mnooorrssst~~

No rounding. Floating point accuracy.

Intended solution

@(s)norm(roots([-1,~1,s^(10/(1+1))]),1/~1)

Try it online!

Luis Mendo

Posted 2017-04-03T12:47:02.247

Reputation: 87 464

Was this close? f=@(s)s^norm(roots([1,2.5,1]),1)? I didn't find a way to make those remaining numbers and +-~~ become 2.5. I had some other attempts that were quite similar (changed the numbers a bit), but I couldn't get it correct. – Stewie Griffin – 2017-04-08T17:56:29.537

@StewieGriffin It was! I have posted the intended solution – Luis Mendo – 2017-04-09T02:07:15.827

2

Python 3.6 - 52 bytes (Cracked by @xnor)

f=lambda x:x**125*77*8+8/5/((('aafoort.hipie.xml')))

Standard Python rounding

c..

Posted 2017-04-03T12:47:02.247

Reputation: 191

Cracked – xnor – 2017-04-04T05:11:42.943

2

Ruby, 35 bytes (cracked by xsot)

'a'0-a<2<e<2<l<3<v<4<4<4<5<5<6>7{9}

No rounding. Floating point accuracy.

G B

Posted 2017-04-03T12:47:02.247

Reputation: 11 099

Cracked – xsot – 2017-04-04T07:53:16.670

2

C#, 112 bytes (cracked by Emigna)

     ((((())))),.....25;;;=CCLMMPPPRSWaaaaaaabbbccdddeeeeeeeeghiiiiiillllmnnnnnooooooorrrsssssssstttttuuvvwy{{}}

no rounding done

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

Jan Ivan

Posted 2017-04-03T12:47:02.247

Reputation: 169

Cracked – Emigna – 2017-04-04T08:48:06.883

You are free to add more cops if you have more ideas, but you should post them in separate answers instead of adding to an existing one. – Emigna – 2017-04-06T09:31:06.977

Ok: http://codegolf.stackexchange.com/a/115492/67504

– Jan Ivan – 2017-04-06T09:40:37.713

2

05AB1E, 47 bytes

)*.2555BFHIJJKKKPQRST``cgghilnstwx}«¹¹Áöž‚„…………

Does not round, uses floating point accuracy.

Okx

Posted 2017-04-03T12:47:02.247

Reputation: 15 025

Cracked – Emigna – 2017-04-04T11:17:59.283

2

CJam, 8 bytes (Cracked by Enmigmna)

WYdYl##+

No rounding. Uses double precision.

Roman Gräf

Posted 2017-04-03T12:47:02.247

Reputation: 2 915

Cracked – Emigna – 2017-04-04T11:25:47.887

2

Fireball, 8 bytes (Cracked by Roman Gräf)

♥1Z*^²/♥

Does not round, uses floating point precision.

Code surrounded with hearts ;)

Should pretty easy to crack, once you have a look into Fireball.

Okx

Posted 2017-04-03T12:47:02.247

Reputation: 15 025

Cracked – Roman Gräf – 2017-04-04T11:02:58.903

2

R, 32 bytes (Cracked by @plannapus)

i=na*0.5f*n(2*s*cos(t))*22*s*12u

Standard floating-point accuracy.

Steadybox

Posted 2017-04-03T12:47:02.247

Reputation: 15 798

Cracked. – plannapus – 2017-04-04T14:37:20.337

2

Excel, 26 bytes

=(())*//11122AAAIINPQRSST^

No rounding.

Note: As Excel is paid software, this works also in free LibreOffice

pajonk

Posted 2017-04-03T12:47:02.247

Reputation: 2 480

1Is there a way to run this without buying Excel? Currently it is the consensus that non free languages cannot be used in cops and robbers. – Post Rock Garf Hunter – 2017-04-04T15:22:59.720

1Should work in free Libreoffice, but I'll check and reach back. – pajonk – 2017-04-04T15:28:00.560

1Works just fine. – pajonk – 2017-04-04T15:34:23.087

@WheatWizard, not relevant anymore, but I think the consensus is: Non-free languages can be used, but should be marked as non-competing.

– Stewie Griffin – 2017-04-05T19:40:59.383

2

NO!, 41 bytes (Cracked by Emigna)

NOOO! NO! can finally compete! Although no-one will be bothered to crack this anyway :(

Anyway sigh here's the code:

NNNOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO??
nnno!

Full list of commands here. Coded in Python so uses Python rounding.

NOOOOOOOOO!!!!!!!! Someone cracked it. (Curse you Emigna!) (just kidding!)

caird coinheringaahing

Posted 2017-04-03T12:47:02.247

Reputation: 13 702

Introducing a new language will be fun ... Cannot wait ro strugle to crack it – Mr. Xcoder – 2017-04-04T18:04:05.430

@Mr.Xcoder can I add another one? I think I might add it to this post for convenience.

– caird coinheringaahing – 2017-04-04T18:57:39.803

Post another answer to NOT! mess up the two @ThisGuy – Mr. Xcoder – 2017-04-04T18:58:30.983

I think you mean "consonants" in your documentation (not constants). – Dave – 2017-04-05T19:37:05.303

@Dave D'oh! ☺️ – caird coinheringaahing – 2017-04-05T19:41:34.063

hmm, what's the canonical version of your interpreter for this challenge? Current master doesn't compile due to a typo on line 162 (there's also a typo on line 163 and missing self. on 149). – Dave – 2017-04-05T20:03:39.537

Guessing not required for this challenge, but bug report: the condition on 174 doesn't match the documentation: O on its own will be skipped, not interpreted as 0.1 – Dave – 2017-04-05T20:14:17.140

@Dave corrected – caird coinheringaahing – 2017-04-05T20:54:52.537

Cracked? – Emigna – 2017-04-05T21:21:38.953

2

C, 115 bytes, (Cracked by @tehtmi)

""%&&((((((()))))))******++++,..//01122233388;;;;;;<====>>   bbbdddeeeefffggillllllllllnnnnnnnnoooooooooooprrtuuu{}

Notice that it does include 3 spaces.

Always outputs 3 exact decimals, rounded to the closest thousandth.

Should be rather fun to crack as it doesn't involve any built-in to compute powers or square roots, as opposed to most (cracked) solutions so far.

Example run (which also gives you a few small hints):

int main() {
  int n[] = {4, 6, 9, 25};
  for (int i = 0; i < 4; i++) {
    printf("%i => ", n[i]);
    o(n[i]);
    printf("\n");
  }
}

outputs:

4 => 32.000
6 => 88.182
9 => 243.000
25 => 3125.000

Tested with both gcc and clang, with no compilation flag needed.


It's been cracked; the 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 magic constant in the same spirit as the infamous fast inverse square root algorithm to do just a handful of Newton iterations (as opposed to several thousands in the cracked solution)

user4867444

Posted 2017-04-03T12:47:02.247

Reputation: 275

It could actually be 3 bytes shorter, at a cost of completely sacrificing performance though :) (as in, becomes really, really slow) – user4867444 – 2017-04-05T01:58:53.030

Crack? Probably not exactly what you're going for, but maybe similar and I think it is okay. – tehtmi – 2017-04-06T08:25:19.640

@tehtmi not quite, see my comment there (your solution does not return correctly for input 0) – user4867444 – 2017-04-06T17:00:12.507

2

HODOR, 172 bytes, Cracked by Emigna

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

let me know if I missed anything

wwj

Posted 2017-04-03T12:47:02.247

Reputation: 81

Nope, this is scrambled – wwj – 2017-04-05T14:26:29.863

just approved your edit, I wrote this up last night... I think the interpreter I was using might have been out of date... I will need to check to make sure the code still works when I get home – wwj – 2017-04-05T14:32:32.233

I'm checking it now. See if I can crack it – caird coinheringaahing – 2017-04-05T14:33:14.030

Cracked – Emigna – 2017-04-05T15:01:49.583

2

05AB1E, 35 bytes

ö£=s‰sr2xöR+RM0`.T"YVBYCDž„¨¨"6£H-L

This one took me a while to make.

There's some double quotes in there, so you can surround as much of the code as you want in them.

No rounding, decimal point precision.

Okx

Posted 2017-04-03T12:47:02.247

Reputation: 15 025

2

Lua 5.3, 110 bytes (safe)

((((()))))**,,,,,-....=====>~             aaaaaaaaacddddeeeffhhhiiiiiiilllmmnnnnnnooopppppprrrrrrrsssssssstttt

Calculations are standard using Lua numbers (ie double in common implementations). Tested using PUC-Rio interpreter. (I hope I didn't do anything bad, but I think it is reasonable...)

This is a full program with input from the command line.

Original solution:

for a,r in pairs(math)do l,s=pcall(r,-math.pi)if s~=s and a>=(i or a)then i,p=a,r end end s=...print(s*s*p(s))

Explanation:

math.sqrt is retrieved from the math library by looping through the math table and looking for functions that return NaN (and don't throw an error) when applied to negative pi. There are only a few functions like this, and sqrt is alphabetically last.

tehtmi

Posted 2017-04-03T12:47:02.247

Reputation: 446

2

05AB1E, 23 bytes (Cracked by Emigna)

A totally different approach than my previous answers :)

$++/02;@DDDGHP\rrszz}¹ž

No rounding.

Example runs

In   -> Out
0    -> 0
4    -> 32.0
6    -> 88.18163074019441
25   -> 3125.0
7131 -> 4294138928.8967724

user4867444

Posted 2017-04-03T12:47:02.247

Reputation: 275

Cracked – Emigna – 2017-04-07T16:51:07.340

Dammit :-D ! This wasn't the intended solution, mine was $žHGDzrDz0@+2s/r+;}\¹DP, using the convergent sequences u_0 = 1, v_0 = x, u_(n+1) = 2 / (1/u_n + 1/v_n), v_(n+1) = (u_n + v_n) /2 to compute the square root. But very well done! – user4867444 – 2017-04-07T17:14:40.463

The thing is, it's hard to come up with an approximation method that can't be tweaked back into Newtons' iterations, mmh... – user4867444 – 2017-04-07T17:15:47.127

Oooh, that was a cool implementation. I figured my crack wasn't the intended :) – Emigna – 2017-04-07T17:19:11.320

2

Javascript, 15 17 bytes, Cracked by @Emigna

(x=>x****-125*10)

Solution:

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

Javascript, 18 bytes, Again, Cracked.

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

Solution:

x=>x**(3-!+[]+.5);

Matthew Roh

Posted 2017-04-03T12:47:02.247

Reputation: 5 043

Cracked. I was really wondering how to do it without the parenthesis ;) – Emigna – 2017-04-12T11:31:18.333

Cracked 2nd – Emigna – 2017-04-12T11:52:38.963

1

Python 3.6 - 15 bytes (Cracked by Kritixi Lithos)

axx 2*d:b.*5mal

Standard rounding precision of Python

Mr. Xcoder

Posted 2017-04-03T12:47:02.247

Reputation: 39 774

2Cracked! – user41805 – 2017-04-03T16:20:27.640

@KritixiLithos well done +1 – Mr. Xcoder – 2017-04-03T16:21:49.683

1

C++, 100 bytes (Cracked by @fergusq)

#.leiha2dm"
tuchn"crmueie<linaatt#dso
fameng pcae sli;t>dt nnsiuno;s mnpti;ouic(<){n(a;>w<n>n)co.,5}

Standard C++ rounding precision

Mr. Xcoder

Posted 2017-04-03T12:47:02.247

Reputation: 39 774

1Cracked! – fergusq – 2017-04-03T17:15:37.543

1

Python 2, 44 Bytes (Cracked by @fəˈnɛtɪk)

np5w***i0(0(0r0n0t+iarn00p0)_(0tu00i50.0)) t

Has accuracy up to 10 decimal digits (I think). No rounding involved and there is a space involved.

Anthony Pham

Posted 2017-04-03T12:47:02.247

Reputation: 1 911

1Cracked! – fəˈnɛtɪk – 2017-04-03T17:38:06.530

@fəˈnɛtɪk you should edit the answer you've cracked. Well done! – Mr. Xcoder – 2017-04-03T17:45:37.947

1

Scala, 19 bytes (Cracked by @math_junkie)

)>,/2(=addd.hmoptw5

This is a function of type Int=>Double.

corvus_192

Posted 2017-04-03T12:47:02.247

Reputation: 1 889

Cracked! – math junkie – 2017-04-03T19:08:09.650

1

C, 60 bytes (Cracked by @Dave)

1(root, flat*fat bern**lotr);pw(f{bus(--q.b4/q0*1-2)})(b>1)b

Standard C float accuracy.

Steadybox

Posted 2017-04-03T12:47:02.247

Reputation: 15 798

Cracked: http://codegolf.stackexchange.com/a/115113/8927

– Dave – 2017-04-03T20:04:40.333

1

05AB1E, 4 bytes (Cracked by @Mr. Xcoder)

Must be really easy to crack, but I'll still post it here

n*t¹

Normal rounding

P. Knops

Posted 2017-04-03T12:47:02.247

Reputation: 301

1

05AB1E, 23 bytes (Cracked by Emigna)

Another try

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

Normal rounding

P. Knops

Posted 2017-04-03T12:47:02.247

Reputation: 301

Cracked – Emigna – 2017-04-04T17:11:03.230

1

JavaScript + paper.js, 210 bytes (safe)

This one's fun. No comments for you, and no strings either.

paper.js is a vector graphics framework. This is a full program that takes input via a prompt and outputs graphically, because it's possible. There is no rounding and floating-point accuracy (I think).
Reference
Try code here

Math.tan(prompt(a,0));
leg Rave, ew(0,0),ectoPlasm = Real new qrt(;
marvin atTax M(en) in vr;tent * hat.o = Mat
nottet near(0a,a) w cgee;
brown.cern(lantern) ;( w 0,0.art;vict.o brace
r=v=,h.c.)an=.flClr= Cor0)

Edit: Just noticed (my fault for not reading properly)

The shortest safe answer by the end of April will be considered the winner.

Well, oops.

Original solution:

var a = prompt(0,0);
var r = new Rectangle(0,0,a,a).area;
var t = new Rectangle(0,0,Math.cbrt(a),Math.sqrt(Math.cbrt(a))).area;
var n = new PointText(view.center);
n.content = r * t;
n.fillColor = new Color(0);

Try code here

ivzem

Posted 2017-04-03T12:47:02.247

Reputation: 1 129

1

05AB1E, 22 bytes, Cracked by user4867444

+/;DDDFLPT_nz}©®¹¹¹Ïè›

Example runs

In -> Out
0  -> 0
4  -> 32.0
6  -> 88.18163074019441

Original solution

LnD¹›_Ï®©èTFD¹/z+;}¹DP

Emigna

Posted 2017-04-03T12:47:02.247

Reputation: 50 798

Cracked! – user4867444 – 2017-04-07T16:15:00.840

1

Javascript (ES6), 39 bytes (Cracked)

(((())))*....57===>Mabcefghlllloprttxxx

The rounding is normal floating point precision for Javascript.

SLuck49

Posted 2017-04-03T12:47:02.247

Reputation: 901

Cracked – GOTO 0 – 2017-04-05T19:29:13.763

1

HODOR, 198 bytes (Cracked by wwj)

NB: Had to correct the code!

Uses the brand-new hodor command (Updated Saturday)! Yes, I know I'm not supposed to say but it's pretty obvious anyway and (as far as I know) I'm the only person who can code in Hodor so worth some help :)

This is the code: and the full list of commands is here

H!HDHrlrHrhoooo!h, oo!do ordoH!oHHd
dodHrodorooooHdddoooOOo ddro roorrro.r,H
ooO ooHr,
HdHo oo H!O?Hd, oo,, Hdodhd oor, dd!HHrDo aod
rdroHdH,HrRr
 o o RHrdHoo,oro Hr
oo
oHoer o r oddodo,rr
rdd!WrH d

caird coinheringaahing

Posted 2017-04-03T12:47:02.247

Reputation: 13 702

Can you please mark this as non-competing, since nobody uses this language? Also, please edit the link – Mr. Xcoder – 2017-04-04T19:39:05.393

1The fact that nobody uses the language doesn't mean it should be non-competing. non-competing only applies for language (or features) that postdate the challenge. So if your solution works on Hodor as it was before the challenge, then it's competing. – Dada – 2017-04-05T08:05:44.107

How do I run the Hodor interpreter? – Emigna – 2017-04-05T12:59:54.880

1@Emigna working on a file that will run from command line but for now will add a note in README (English version) – caird coinheringaahing – 2017-04-05T13:20:52.420

Is there perhaps a bug on row 118 in the interpreter? I can't get my program to work without changing that. Also, h should be in VALID_CHARS right? – Emigna – 2017-04-05T14:17:42.470

@Enigma What version of Python are you using. I've fixed it btw – caird coinheringaahing – 2017-04-05T14:19:11.790

I was using python 3. – Emigna – 2017-04-05T14:19:36.257

@Emigna Yeah it needs either [] or () around it to work – caird coinheringaahing – 2017-04-05T14:20:14.070

Let us continue this discussion in chat.

– Emigna – 2017-04-05T14:24:11.967

1

JavaScript (ES7), 24 bytes (Safe)

()+01488M``aabeiijlooqtv

Standard 64 bit floating point rounding.


Solution

eval(atob`8j0+8ioqMi41`)

Tests

console.log(eval(atob`8j0+8ioqMi41`)(0));    // 0
console.log(eval(atob`8j0+8ioqMi41`)(1));    // 1
console.log(eval(atob`8j0+8ioqMi41`)(2));    // 5.656854249492381
console.log(eval(atob`8j0+8ioqMi41`)(4));    // 32
console.log(eval(atob`8j0+8ioqMi41`)(10));   // 316.22776601683796

Ally

Posted 2017-04-03T12:47:02.247

Reputation: 11

1

Stacked, 64 bytes

:u#{`E2t#tv',lnp~.iuP#2qr+t,'3m3em`,#9''.::mluls on\ts r:a\:+.S0

Good luck.

Result for 6: 88.181630740194411535.

Conor O'Brien

Posted 2017-04-03T12:47:02.247

Reputation: 36 228

Maybe linking to https://github.com/ConorOBrien-Foxx/stacked would be more helpful.

– user4867444 – 2017-04-07T01:22:13.337

@user4867444 If you click on "stacked" in the link above it gets your there anyhow. – Conor O'Brien – 2017-04-07T01:22:50.950

Takes me to https://tio.run/nexus/stacked rather, which is not super helpful to learn about the language?

– user4867444 – 2017-04-07T01:24:41.197

@user4867444 Perhaps my wording is confusing. On the tio.run page, clicking on "stacked" gets you to the github. Shown in this image Admittedly, it's a tad convoluted.

– Conor O'Brien – 2017-04-07T01:35:09.140

1

bash, 158 bytes

This program requires a 64 bit processor to function. Pass input number as argument; result on stdout. I believe rounding is floor function. This program actually does decimal output. If you got integer only keep trying.

^=======|       -!
///////......
''(((((((((((())))))))))))
[]$$$$$$$$$****
\\\\\\
#++
000000000000
111111222
bcdddeeeehhhiill
nn
NNNNNNoooOOOOOOO
sssSSSS
tw

Joshua

Posted 2017-04-03T12:47:02.247

Reputation: 3 043

1

C#, 135 bytes (cracked by SLuck49)

      (((((()))))),,-..../11;;;CCEILMMMPPPRRSSWaaaaaaacccdddeeeeeeeeggghiiiiiiiillllmmnnnnnnnnoooooooorrsssssssssssttttttttuuuvwyy{{}}

no rounding done
(First try)

Jan Ivan

Posted 2017-04-03T12:47:02.247

Reputation: 169

Cracked This was fun. – SLuck49 – 2017-04-07T20:32:55.853

1

Javascript (ES7), 53 bytes (safe)

(((())))*++++,,,/0233346=====>>[[]]aaaabbbccelootttuv

The rounding is normal floating point precision for Javascript.

Tested this in the latest Chrome and FF.


Solution

u=>(o=(t,c,a=o+c,b=a[t])=>eval(a[42]+b+b+3*30/t))(36)

This works because a=o+c is '(t,c,a=o+c,b=a[t])=>eval(a[42]+b+b+3*30/t)undefined'.
So a[42]='u', a[36]='*', 3*30/36=2.5, making eval('u**2.5').

Tests

var f=u=>(o=(t,c,a=o+c,b=a[t])=>eval(a[42]+b+b+3*30/t))(36);
console.log(f(0));    // 0
console.log(f(1));    // 1
console.log(f(2));    // 5.656854249492381
console.log(f(4));    // 32
console.log(f(10));   // 316.22776601683796

SLuck49

Posted 2017-04-03T12:47:02.247

Reputation: 901

1

05AB1E, 15 bytes, (Cracked by Emigna)

+/01;DDDFMPs}¹ž

Normal rounding

Example runs

In   -> Out
0    -> 0
4    -> 32.0
6    -> 88.18163074019441
25   -> 3125.0
7131 -> 4294138928.896773

user4867444

Posted 2017-04-03T12:47:02.247

Reputation: 275

Cracked, right back at ya :P – Emigna – 2017-04-07T16:37:30.830

@Emigna: eh, I figured it was only a question of time, same method ;) good job! – user4867444 – 2017-04-07T17:11:34.653

1

Python 2.7, 174 bytes

_cc*gnta(dkree_rtrto._i9kuc_ l5_r_cctbimWka(Wihlkeu_5_eur_rri_keeluc4clrp ..u_)(HohhH)ap5o(trbnord_ir9/*in)_clrikroap.ie.tg_obkfkseeeel*in2Hkdu*ffmo4lWlrncde_22);doodt a49 hu

penalosa

Posted 2017-04-03T12:47:02.247

Reputation: 505

1

05AB1E, 27 bytes - safe

Yet another totally different approach from my previous answers.

(/1DFFOOPT`ins}}©®¹¹Ðèëž‚‚‹

No rounding.

Example runs

In   -> Out
0    -> 0
4    -> 32.0
6    -> 88.18163074019441
25   -> 3125.0
7131 -> 4294138928.896773

Solution

Ð(‚žFFDO©n¹‹i`T/ë1è®s}‚}O¹P

This is simply computing the square root with a trivial (and very dumb) trial-and-error strategy...

Detailed explanation

Ð(‚žFFDO©n¹‹i`T/ë1è®s}‚}O¹P
Ð(‚                         # triplicate the input, reverse the sign of the last copy, and wrap the last 2 items in a list, which going forward is going to be the list of our current sqrt approximation and of the next decrement in our dumb search (so it starts at [x, -x])
   žFF                      # 16384(!) times, do
      D                     # duplicate the current [value, decrement] list
       O©                   # compute the sum value + decrement, and also save it in the register
         n                  # compute the square of that potential new approximation of the square root
          ¹‹                # and compare it with the input
            i               # if our new approximation is smaller than the actual square root, then
             `              # push the flattened [value, decrement] list to the stack as value, decrement
              T/            # and divide our decrement by 10
                ë           # else (our new approximation is still bigger than the actual square root, then)
                 1è         # extract the current decrement from the list
                   ®        # retrieve the new approximation from the register
                    s       # and switch them to again have them in the value, decrement order
                     }      # end of the if
                      ‚     # no matter which branch of the if we went into, the last 2 items of the stack are now the new approximation and the new decrement, in order: wrap them in a list for the next loop iteration
                       }    # end of the loop
                        O   # replaces the output of the loop (the final [value, decrement] list) by its sum, which given the very small value of the decrement at that point is pretty much the same as our final approximation of sqrt(x)
                         ¹  # push another copy of x; the stack is now [x, sqrt(x), x] (where the first x comes from the very first copy of the initial Ð)
                          P # computes the product of the whole stack

Try it online!

user4867444

Posted 2017-04-03T12:47:02.247

Reputation: 275

1

Java 7, 224 bytes (safe)

      ""&&((((((((()))))))))***++++++,,,,,,,-......//000000001113344556677;;;;;;;;;;<<======>>LLSS[\\\\\]aaaaaaaabbbbcccccccccdddddddddeeeeffffggggggiiiiiiiklllmmmnnnnnnnoooooooopprrrrrrssssssssssssstttttttttttuuuuuuuuvy{{}}

Look I know it's a lot of bytes but it's a full java program so you can expect a good portion of it to be basic boiler plate... and surely there are no tricks being employed. Output has 3 decimal places and operates the same as the examples in the challenge. I could probably make this harder but part of the fun is seeing how you end up breaking this and solving it in an unintended way. Good luck!

P.S. that's 6 spaces in case you're curious.

Example Runs

0    ->          0.000
4    ->         32.000
6    ->         88.182
25   ->       3125.000
7131 -> 4294138928.897

Solution:

class u{static double s,a,c,n,d,g,t;public static void main(String...u)\u007bd=Long.parseLong(u[0]);n=d/(c+++1);for(;g<(t=13);g++){for(;s<n;s+=c)if(s*s>d&&(s-=c)>0)break;c/=t;}System.out.format("\045\0563\146",s*d*d);}\u007d

Ungolfed:

class u{
static double s,a,c,n,d,g,t;               // static doubles default to 0.0
public static void main(String...u)\u007b  // had to use 1 or 2 unicode escapes for fun

d=Long.parseLong(u[0]);
n=d/(c+++1);                              // get d/2 while also making c=1

for(;g<(t=13);g++){                       // get 13 decimals of precision
  for(;s<n;s+=c)                          // increment the current decimal position
    if(s*s>d&&(s-=c)>0)break;             // square the current value and make sure we're still below the target
  c/=t;
}
System.out.format("\045\0563\146",s*d*d); // java also has octal string escapes
}
\u007d

Poke

Posted 2017-04-03T12:47:02.247

Reputation: 3 075

0

Python 2, 39 bytes (cracked by @Mr. Xcoder)

q=a(lxt)mh*mprf.hr
ax tttaixxmb :m*asod

Standard Python float rounding.

Comrade SparklePony

Posted 2017-04-03T12:47:02.247

Reputation: 5 784

Cracked. – Mr. Xcoder – 2017-04-03T18:00:03.157

0

C#, 179 bytes, safe

(((((((((((((())))))))))))))*****++,,,,,-..///////000000000111112222222222:;;;<=====>>>>?AFM[[[[[[[[[[[]]]]]]]]]]]abbbcdddddeeeeehllllnnnnnnnnnnnnnooooooooooorrrrrsttuuuuuww{{{}}}

There is no rounding. The code forms a lambda that takes an int and returns a double.


Solution

n=>{Func<double[],double>r=null;return(r=(o)=>(Math.Abs(o[1]-o[2])>=0.0000001)?r(new[]{o[0],o[2],(o[2]+(o[0]/o[2]))/2}):o[2])(new[]{n,(n*1d)/2,((n*1d)/2+(n/(n*1d)/2))/2})*(n*n);};

Exploded Solution

(int n) => 
{
    Func<double[], double>r = null;

    r = (double[] o) =>
    { 
        if(Math.Abs(o[1]-o[2]) >= 0.0000001))
        {
            return r(new[]{ o[0], o[2], (o[2] + (o[0] / o[2])) / 2 });
        }
        else
        {
            return o[2];
        }
    };

    var initialO = new[]
    { 
        n, 
        (n * 1d) / 2, 
        ((n * 1d) / 2 + (n / (n * 1d) / 2)) / 2 
    };

    return r(initialO) * (n * n);
};

Michael Coxon

Posted 2017-04-03T12:47:02.247

Reputation: 131

0

Python 3.6 - 64 bytes (Cracked by user4867444)

f1;7*x0d/2p6*mm1i*99 5 a o o t(a bphpx:m38af4r*1221=s2rm.0itlpa)

Extremely high precision. No rounding.

ORIGINAL SOLUTION:

from math import pi as p;f=lambda x:x**(p**3/12.402510672119928)

Mr. Xcoder

Posted 2017-04-03T12:47:02.247

Reputation: 39 774

Cracked! – Kyle G – 2017-04-06T01:40:40.170

@KyleGullion not very creative, but smart. I'll post the original solution shortly – Mr. Xcoder – 2017-04-06T04:32:50.497

0

PHP, 61 Bytes (Safe)

No rounding

a$rians=)n$$/rnd=aa(*gt$)gg*g)(g)$(r|pg-n(+(;$r($)(tr)=r)ngq.

Original Solution

print($argn**(sqrt(((a|n).rd)($g=$argn==$argn))/($g+$g)-$g));

Jörg Hülsermann

Posted 2017-04-03T12:47:02.247

Reputation: 13 026

0

Python 2.7, 41 bytes

(sexypint=='pint')**(55.0)**fur==(.3%0%y)

rounding done by "%.3f"

Koishore Roy

Posted 2017-04-03T12:47:02.247

Reputation: 1 144

1Cracked! – ovs – 2017-04-08T14:46:15.853