29
\$\begingroup\$

For the main cops' challenge, click here

NOTICE - This challenge is now closed. Any cracks which are posted now will not be counted on the leaderboard and the accepted answer will not change.

Challenge

Given the original program, its output and the output of the changed program, you have to find out which characters need to be changed, removed or added to get the expected output.

When you crack someone's code, leave a comment with a link to your crack on their answer.

Formatting

# [<language>, <username of program owner>](<link to answer>)

## Description

<description of change and how you found it>

## Code

<changed code>

Winning

The person who has cracked the most solutions wins.

Leaderboard

13 cracks:

  • Dennis

8 cracks:

  • Alex Van Liew

5 cracks:

  • Sp3000
  • isaacg

3 cracks:

  • Luis Mendo
  • jimmy23013
  • Dom Hastings

2 cracks:

  • mbomb007
  • Sluck49

1 crack:

  • TheNumberOne
  • Jakube
  • ProudHaskeller
  • David Zhang
  • samgak
  • paul.oderso
  • rayryeng
  • mgibsonbr
  • n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳
  • Stewie Griffin
  • abligh
\$\endgroup\$
1
  • 1
    \$\begingroup\$ @mbomb007 Can you refrain from editing this post, because it makes it harder for me to know where I am when updating the leaderboard \$\endgroup\$
    – Beta Decay
    Aug 13, 2015 at 20:25

61 Answers 61

15
\$\begingroup\$

Ruby, histocrat

Description

Changed x to be an array instead of scalar by adding *

Changed the last 9 to be a string instead of a number by adding ?

The result is made of an array with a single element ([9]) multipled 9 times then imploded with "9" as separator.

Code

x=*9;puts x*9*?9
\$\endgroup\$
12
\$\begingroup\$

Python 2, muddyfish

Description

Through trials and tribulations involving factorizing large numbers and looking for consequtive factors, I realized that changing the 87654 to 58116 would be enough. Then, I factorized 58116 as 87*668. Then I realised that 01234 = 668, so I just needed to change 87654 to 87 and remove the 01234 entirely. This is accomplished with a comment.

Code

print (sum(range(054321)*9876)*87)#654)/01234
\$\endgroup\$
2
  • \$\begingroup\$ Yep, almost exactly how I had it (Mine was print sum(range(054321)*9876)*87#654)/01234) \$\endgroup\$
    – Blue
    Aug 12, 2015 at 7:32
  • \$\begingroup\$ Clever clever! I'm glad someone got it, and that it was more interesting than "play with numbers"! \$\endgroup\$ Aug 12, 2015 at 16:48
11
\$\begingroup\$

Shakespeare, AboveFire

In Scene III, one has to change Claudius into Claudio in the following snippet:

[Enter Claudio]

Claudius:
 Thou art as stupid as the sum of thee and the product of the 
 product of me and Helen and Helena

[Exeunt]

Modified code:

The Hidden Change.

Helen, a young woman with a remarkable patience.
Helena, a likewise young woman of remarkable grace.
Claudio, a remarkable man much in dispute with Claudius.
Claudius, the flatterer.
The Archbishop of Canterbury, the useless.


          Act I: Claudius's insults and flattery.

          Scene I: The insulting of Helen.

[Enter Claudius and Helen]

Claudius:
 Thou art as hairy as the sum of a disgusting horrible fatherless 
 dusty old rotten fat-kidneyed cat and a big dirty cursed war.
 Thou art as stupid as the product of thee and a fat smelly 
 half-witted dirty miserable vile weak son.

[Exeunt]

          Scene II: The complimenting of Helena.

[Enter Claudio and Helena]

Claudio:
 Thou art the sunny amazing proud healthy peaceful sweet joy.
 Thou art as amazing as the product of thee and the pretty
 lovely young gentle handsome rich Hero. Thou art as great 
 as the sum of thee and the product of a fair golden prompt good honest 
 charming loving noble king and a embroidered rich smooth golden angel.

[Exeunt]

          Scene III: The insulting of Claudio

[Enter Claudius and Helen]

Helen:
 Thou art as stupid as the sum of the sum of thee and a cat and me.
[Exit Helen]

[Enter Claudio]

Claudio:
 Thou art as stupid as the sum of thee and the product of the 
 product of me and Helen and Helena

[Exeunt]

          Scene IV: The Final Countdown

[Enter The Archbishop of Canterbury and Claudius]

Claudius:
 Thou art the sum of you and a cat.

The Archbishop of Canterbury:
 Am I better than a fine road?

Claudius:
 If not, let us return to the insulting of Claudio.

[Exit The Archbishop of Canterbury]

[Enter Claudio]

Claudius:
 Open your heart!
 Open your heart!
[Exeunt]

Using the compiler linked by @AboveFire, this prints 11.

\$\endgroup\$
9
  • 2
    \$\begingroup\$ Can you please make it more clear which characters were changed? It's not exactly easy to see looking back and forth. \$\endgroup\$
    – mbomb007
    Aug 13, 2015 at 15:55
  • \$\begingroup\$ Damn, 15 minutes late. Congratulations. \$\endgroup\$ Aug 13, 2015 at 15:56
  • 2
    \$\begingroup\$ Jeebus H. Christ. Nice job! \$\endgroup\$
    – rayryeng
    Aug 13, 2015 at 16:16
  • 1
    \$\begingroup\$ @mbomb007 I hope my edit made it clearer. AboveFire: sorry :) \$\endgroup\$
    – plannapus
    Aug 14, 2015 at 6:39
  • 3
    \$\begingroup\$ @plannapus Haha, it's okay, but the intended way to clear it was to replace the word "king" by "pig".With this change, Helena was equal to 0 and "the sum of thee and the product of the product of me and Helen and Helena" was equal to 1. I had made a list of all words that could be inverted with two letters and used a lot of them in my code(ex: joy->hog->son, war->cat, road->toad, Hero->Hell, curse->purse, helen->helena, claudio->claudius and many others) The only things that can change a Shakespeare program with 2 char is the change of a variable, the change of a noun and the change of a goto. \$\endgroup\$
    – AboveFire
    Aug 14, 2015 at 11:39
10
+50
\$\begingroup\$

CJam, by Mauris

Description

Mauris' original code does the following:

"f~"     e# Push that string on the stack.
    :i   e# Cast each to integer. Pushes [102 126].
      :# e# Reduce by exponentiation. Pushes 102^126.

No other of CJam's mathematical operators would yield a number that large for small inputs, so :# cannot be modified. Since #, when used for exponentiation, only takes integers as input, :i cannot be removed as well. This leaves only one place to modify the input: the string "f~".

No matter how many characters the string holds, the result will be a left-associative power tower. CJam supports characters in the range from 0 to 65535 (with the exception of surrogates), so we have to express the output as bn×k×j, where b, n, k and j are integers in that range.

The decimal logarithm of the integer that results from the modified code is slightly smaller than log10(2.44×10242545) = log10(2.44) + 242545, so we can divide this value by the logarithms of all possible bases to find proper values for n×k×j.

In fact:

$ cjam <(echo '65536,2>{2.44AmL242545+1$AmL/i:I#s8<"24399707"=}=SIN')
5 347004

Comparing the first 8 digits turned out to be sufficient.

This means that we can express the output as 5347,004 = 1562557,834 = 1259×102×126, so it suffices to replace "f~" with "㴉" or "} f~".

Code

"㴉":i:#

or

"}  f~":i:#

Note that the spaces in the ASCII code should actually be a tabulator.

Attempting to execute this code in the online interpreter is probably a bad idea, but here's how you can verify the results from the command line:

$ wget -q https://bpaste.net/raw/f449928d9870
$ cjam <(echo '[15625 57834]:c`":i:#") > mauris.cjam
$ cat mauris.cjam; echo
"㴉":i:#
$ cjam mauris.cjam | diff -s - f449928d9870
Files - and f449928d9870 are identical
$ echo -en '"}\tf~":i:#' > mauris-ascii.cjam
$ cat mauris.cjam; echo
"}  f~":i:#
$ cjam mauris-ascii.cjam | diff -s - f449928d9870
Files - and f449928d9870 are identical
\$\endgroup\$
9
  • 11
    \$\begingroup\$ One does not simply beat Dennis in CJam \$\endgroup\$
    – Fatalize
    Aug 11, 2015 at 20:10
  • \$\begingroup\$ How did you figure out what numbers to use? \$\endgroup\$ Aug 11, 2015 at 20:13
  • \$\begingroup\$ @AlexVanLiew Brute force. I'm currently writing an explanation. I just wanted to get the crack posted before somebody else did. \$\endgroup\$
    – Dennis
    Aug 11, 2015 at 20:14
  • \$\begingroup\$ @Dennis: Fair enough. I was trying this one but I don't know CJam; I figured the intended solution involved actually using ~f somewhere in the program. \$\endgroup\$ Aug 11, 2015 at 20:16
  • 1
    \$\begingroup\$ @Mauris The question says when just two characters in the program are changed (emphasis mine), so I assumed this was OK. Anyway, factorizing the number was the hard part. \$\endgroup\$
    – Dennis
    Aug 11, 2015 at 20:23
10
\$\begingroup\$

Prolog, Fatalize

Description

Add two \s. \ is bitwise negation and \/ is bitwise or.

Code

X is \1\/42.
\$\endgroup\$
1
  • \$\begingroup\$ Correct solution \$\endgroup\$
    – Fatalize
    Aug 11, 2015 at 15:18
8
\$\begingroup\$

MATLAB/OCTAVE, Stewie Griffin

A simple bit of complex arithmetic.

acos(i)
\$\endgroup\$
7
\$\begingroup\$

C, LambdaBeta

Description

Turn main(a,_) into main(_). The first argument of main is argc which is initialized as 1.

Code

main(_){puts(_*_-1||_*_*_-1||_*_*_*_-1?"Expected Output":"?");}
\$\endgroup\$
1
  • \$\begingroup\$ That's the solution I had in mind. Nice catch. Incidentally if the argv happens to be loaded into memory cell 1 this will not work. I just can't think of any system that would do that that can also run the various interpreted languages on that page. \$\endgroup\$
    – LambdaBeta
    Aug 11, 2015 at 15:50
6
\$\begingroup\$

Python 2, rp.belrann

Change the outermost list comprehension into a set comprehension. Partial credit to @mbomb007, who eliminated all of the "boring" solutions (swapping x and y around, tweaking operators, changing the range).

'~'*sum({(x,y)[x%2] for x in[y for y in range(8)]})

Explanation:

In the original, [(x,y)[x%2]for x in[y for y in range(8)]] generates the following list:

[0, 7, 2, 7, 4, 7, 6, 7]

This is because in Python 2.7, the y in the inner list comprehension leaks into the enclosing scope at it's last known value (which, at the end of a range, is 7). So, in the tuple, y is always 7. x, however, goes through the list as normal, ranging from 0 to 7. When x is even, it chooses the value of x, when it's odd, it chooses y (which is always 7). I noticed that if I included exactly one 7 and all the rest of the values of x, I got 19; then I realized that I could transform the outer comprehension into a set comprehension, which would eliminate all duplicate values and leave me with exactly 19.

This was pretty clever, I don't think I've ever used a set comprehension before. Kudos.

\$\endgroup\$
4
  • \$\begingroup\$ nope. That's not it. print len('~'*sum([(x,y)[x%2]for x in[y for y in range(6)]])) returns 21. Just assign the code to a variable then print if it equals the string you want. If you see True, you cracked it. \$\endgroup\$
    – mbomb007
    Aug 13, 2015 at 16:40
  • \$\begingroup\$ Bizarre. _ betrayed me, I guess. \$\endgroup\$ Aug 13, 2015 at 16:45
  • \$\begingroup\$ @mbomb007 I got it. \$\endgroup\$ Aug 13, 2015 at 16:53
  • \$\begingroup\$ You got me. Well done. \$\endgroup\$
    – rp.beltran
    Aug 13, 2015 at 17:01
6
\$\begingroup\$

Jonas, Matlab/Octave

Description

I noticed the answer was i^pi, so then I justed had to turn sin into a nop.

Code

0i+(i^pi)

s -> 0, n -> +

\$\endgroup\$
2
  • \$\begingroup\$ Nicely done sir. \$\endgroup\$
    – rayryeng
    Aug 13, 2015 at 21:28
  • \$\begingroup\$ Very well done!! \$\endgroup\$
    – Luis Mendo
    Aug 13, 2015 at 21:46
5
\$\begingroup\$

Bash, Dennis

Original code:

echo {{{1..9}}}

Original output:

{{1}} {{2}} {{3}} {{4}} {{5}} {{6}} {{7}} {{8}} {{9}}

Modified code:

echo {,{1..9},}

Modified output:

1 2 3 4 5 6 7 8 9

Explanation:

In Bash you can output a comma separated list of items inside a pair of braces, like this:

echo {a,b,c}

prints

a b c

So the modified code is printing out a list of nothing, the numbers 1..9, nothing.

\$\endgroup\$
5
\$\begingroup\$

MATLAB, Luis Mendo

Original code:

-sin(2:.5:3)    
ans =    
   -0.9093   -0.5985   -0.1411

New answer:

psi(2:.5:3)
ans =
    0.4228    0.7032    0.9228

Description:

Changed -sin to psi, the polygamma function in MATLAB. The - sign is substituted by p and the n is removed.

\$\endgroup\$
0
4
\$\begingroup\$

C, LambdaBeta

Description

Change -1 into *0 so that the result of the multiplication is 0 (a falsy value).

Code

main(a,_){puts(_*_*_*_*_*0?"Expected Output":"?");}
\$\endgroup\$
1
  • \$\begingroup\$ Oops, looks like I introduced a (security flaw?) during my golfing. I'll idly mull it over to see if I can fix it. Nice catch though. \$\endgroup\$
    – LambdaBeta
    Aug 11, 2015 at 13:33
4
\$\begingroup\$

Brainfuck, Kurousagi

Description

Remove the first > and change the first < to .

Tested at brainfuck.tk. Note that the output doesn't match Kurousagi's post exactly, due to SE eating up unprintable characters.

Code

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[>.+<-]
\$\endgroup\$
1
  • \$\begingroup\$ @muddyfish I linked this answer in my second comment, but I'm still awaiting confirmation from Kurousagi \$\endgroup\$
    – Sp3000
    Aug 11, 2015 at 13:23
4
\$\begingroup\$

Fantom, Cain

Security through obscurity is a very poor form of security (especially when the two methods are right next to each other in the Fantom docs and anyone who knows what a float looks like will immediately know what to do).

Float.makeBits32(1123581321)
\$\endgroup\$
4
  • 1
    \$\begingroup\$ You got me by 1 min !!! well played \$\endgroup\$
    – AboveFire
    Aug 11, 2015 at 19:16
  • 1
    \$\begingroup\$ Haha you got me, enjoy the free crack \$\endgroup\$
    – Cain
    Aug 11, 2015 at 20:10
  • \$\begingroup\$ @Cain Was that intentional o.o \$\endgroup\$ Aug 12, 2015 at 0:29
  • 1
    \$\begingroup\$ @BassetHound I mean, it was more of a social experiment, to see if people would bother learning some obscure language for the crack. I should have made it harder though, to take some actual work. \$\endgroup\$
    – Cain
    Aug 12, 2015 at 4:44
4
\$\begingroup\$

CJam, by Basset Hound

25me

Calculates e25. Try it online.

The online interpreter gives a slightly different result in my browser, which seems to be a rounding issue.

The Java interpreter prints 7.200489933738588E10, which is the desired output, but in a different format.

\$\endgroup\$
1
  • \$\begingroup\$ Hehe, it was easy. Especially for a CJam god. Correct. \$\endgroup\$ Aug 11, 2015 at 22:22
4
\$\begingroup\$

Python 2, Sp3000

Description

Changed 01234 to 0x1234 and min to 9in.

The fact that 4669 = (01234-1)*sum(m<<m in R for m in R) is misleading.

Code

R=range(0x1234);print sum(m<<9in(m,n)for m in R for n in R)
\$\endgroup\$
1
  • \$\begingroup\$ Nicely done! I had m<<m in(m,n), but the main thing was to change the min to in. \$\endgroup\$
    – Sp3000
    Aug 13, 2015 at 0:33
4
\$\begingroup\$

MATLAB / Octave, Stewie Griffin

Description

This required negating the input into the anonymous function g, as well as changing the scaling factor of the g function to 2 instead of 7:

Code

>> f=@(x)x^.7;g=@(x)2/f(x);g(-7)

ans =

  -0.3011 - 0.4144i
\$\endgroup\$
1
  • \$\begingroup\$ Thanks for your comment on my (now deleted) answer. I posted a new (very similar) one that can be cracked using WolframAlpha. I believe it's fairer. \$\endgroup\$ Aug 13, 2015 at 17:03
4
\$\begingroup\$

Perl, abligh

Description

Add in string repetition operator, x and insert additional digit!

Code

print sin 95x7
\$\endgroup\$
3
\$\begingroup\$

Java, TheNumberOne

Description

The program is a one-off implementation of Random.next() with a initial seed of Integer.MAX_INT and all the hex numbers converted to decimal. Changing the seed to the complement of MAX_INT generates the output:

class T{public static void main(String[]a){System.out.print(((~Integer.MAX_VALUE^25214903917L)&281474976710655L)*25214903917L+11L&281474976710655L);}}

(since there must be exactly two changes, pick any sort of no-op change: adding a space somewhere, an extra semicolon, etc)

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Nice, You could have also turned Integer.MAX_VALUE into Integer.MAX_VALUE+1 or Integer.MIN_VALUE \$\endgroup\$ Aug 11, 2015 at 17:42
  • \$\begingroup\$ Oh, you know what? I tried +1 but since I was doing it in Python it just rolled over to a long, ahaha. That was my first thought, actually. \$\endgroup\$ Aug 11, 2015 at 18:04
3
\$\begingroup\$

Brainfuck, AboveFire

this program is a modification of this code me a cookie answer. that answer works by first pre-calculating a table of useful ascii codes of useful characters, and then has three conditional statements made up by three loops which are entered to by having a 1 in the correct position.

the start of how i broke the code is that the repeating pattern in the changed output is mostly what is printed if you enter the third loop with the table shifted left.

++++++++++[->++++++++<]>>++++++[-<---------->]<-------[----------->>>-<<+<[->->+<<]]>>>+<<>>>+++[->++++++++++<]>(<)++ .<+++++++++[->>>>>>>++++++++++<+++++<++++++++++++++<++++++++++<+++++<++++++++++<<]++++++++++>>+++++...>++>++>-->+>(>)++++<<<<<<<.<<<[->>>>>>.<<>>>>>.<<<<<.>>>>>.<<<<<>>>.<<<<.>>>>>.<<<<.>>>>>.<<<<<.>>>>.<<<<<.>>>>.<<...>.<<<<<<]>[->>>>>.<<...>>>.<<<<.>>>>>.<<<<...>>>>.<<<<<.>>>>.<<...>.<<<<<]>[->>>>.<<>>>>>>.<<<<<<..>>>.<<<<.>>>>>.<<<<>>>>>>.<<<<<<.>>>>>>.<<<<<<>>>>.<<<<<.>>>>.<<...>.<<<<]

(the additional characters are marked with parentheses)

\$\endgroup\$
3
\$\begingroup\$

Python 2, muddyfish

Description

Change << to <> (deprecated version of !=) and 0x156 to 0156, the code point for "n" (which appears 3 times in the length 23 string '<built-in function sum>').

Code

print sum((ord(i)<>0156 for i in `sum`))
\$\endgroup\$
3
\$\begingroup\$

JavaScript, by Razvan

Description

The modified output is clearly Euler's natural number, which can be accessed as Math['E'].

By changing '' to '3' and 32 to 36, String.fromCharCode generates the E.

Code

a=1,b=a*2,c=a+b,d=[a+b];while(c>b)c-=a;for(i=1;i<=c;i++)d.push(i);i='3'+c*d['length']*d['length'];alert(Math[String.fromCharCode(i.charCodeAt(0) * i.charCodeAt(1) / 36)])
\$\endgroup\$
1
  • \$\begingroup\$ Yes, that's correct. Still it was actually something deeper but it seems that you could bypass it with this trick. I'll think of something else and I'll come back. \$\endgroup\$
    – Razvan
    Aug 12, 2015 at 22:26
3
\$\begingroup\$

Fantom, Cain

Description

The array indexing is set up already, so I just need to make a 55. Honestly, the hardest part was downloading the language.

Code

[7115432d/9,219.or(64),37,55,55][3]

(Inserted a comma, 0 -> 3)

\$\endgroup\$
1
  • \$\begingroup\$ Well crap, that wasn't the intended solution, my red herring was an actual solution \$\endgroup\$
    – Cain
    Aug 13, 2015 at 1:36
3
\$\begingroup\$

Shakespeare, AboveFire

NOT CORRECT - sorry :(

Will look further into it when i get home from work In the original Claudio's value is 1132462081 and Claudius' value is 1

In the final Scene Claudio's value is printed twice,

[Enter Claudio]

Claudius:
 Open your heart!
 Open your heart!

open your heart x2 = print value of the other person on stage (Claudio). So if you change Claudius to Claudio(2 chars) - the value of Claudius will be printed - which is 1 - twice

The Hidden Change.

Helen, a young woman with a remarkable patience.
Helena, a likewise young woman of remarkable grace.
Claudio, a remarkable man much in dispute with Claudius.
Claudius, the flatterer.
The Archbishop of Canterbury, the useless.


          Act I: Claudius's insults and flattery.

          Scene I: The insulting of Helen.

[Enter Claudius and Helen]

Claudius:
 Thou art as hairy as the sum of a disgusting horrible fatherless 
 dusty old rotten fat-kidneyed cat and a big dirty cursed war.
 Thou art as stupid as the product of thee and a fat smelly 
 half-witted dirty miserable vile weak son.

[Exeunt]

          Scene II: The complimenting of Helena.

[Enter Claudio and Helena]

Claudio:
 Thou art the sunny amazing proud healthy peaceful sweet joy.
 Thou art as amazing as the product of thee and the pretty
 lovely young gentle handsome rich Hero. Thou art as great 
 as the sum of thee and the product of a fair golden prompt good honest 
 charming loving noble king and a embroidered rich smooth golden angel.

[Exeunt]

          Scene III: The insulting of Claudio

[Enter Claudius and Helen]

Helen:
 Thou art as stupid as the sum of the sum of thee and a cat and me.
[Exit Helen]

[Enter Claudio]

Claudius:
 Thou art as stupid as the sum of thee and the product of the 
 product of me and Helen and Helena

[Exeunt]

          Scene IV: The Final Countdown

[Enter The Archbishop of Canterbury and Claudius]

Claudius:
 Thou art the sum of you and a cat.

The Archbishop of Canterbury:
 Am I better than a fine road?

Claudius:
 If not, let us return to the insulting of Claudio.

[Exit The Archbishop of Canterbury]

[Enter Claudio]

Claudio: << changed Claudius to Claudio
 Open your heart!
 Open your heart!
[Exeunt]
\$\endgroup\$
3
  • \$\begingroup\$ Nope, Claudio value is not 1 xD. Better luck next time. \$\endgroup\$
    – AboveFire
    Aug 13, 2015 at 11:31
  • \$\begingroup\$ @AboveFire - crud.. I'll have another look at it when i get home, really thought I had it :( \$\endgroup\$ Aug 13, 2015 at 11:33
  • \$\begingroup\$ That was my first guess, too, but I didn't have a chance to try it, yet. Anyway, the only part I didn't understand yet is the one with the archbishop so I'll have a look at that when I get home. \$\endgroup\$ Aug 13, 2015 at 12:07
3
\$\begingroup\$

VBA by JimmyJazzx

Changed IRR to MIRR and changed 5 to a , so there are 3 parameters.

I found this while looking for how Excel's IRR function works. There was an article: How Excel's MIRR Function Can Fix the IRR Function. That tipped me off. Clever attempt, though. I'd never used VBA before, so that was interesting as well.

Sub q()
Dim a(2) As Double
a(0)=-5
a(1)=10
msgBox MIRR(a,0.2,3)
End Sub
\$\endgroup\$
1
  • \$\begingroup\$ Nice. Technically i added both the M and the , so the middle arg was 0.25 but i think they end up having the same result anyway. Thought using some finance functions could stump the programmers but was revealed by the documentation. Good job \$\endgroup\$
    – JimmyJazzx
    Aug 13, 2015 at 17:22
3
\$\begingroup\$

Matlab / Octave, Jonas

Description

In the last line, add ' to transform arg' into the string 'arg', which will then be interpreted as ASCII numbers. And then add another ' at the end to maintain the column format.

The almost unnecessary ' in the original code was the main clue. Also, in restrospect, the fact that arg was defined separately (instead of directly within the sin line) should have looked suspicious.

Code

format long
arg = [.1 .2 .3];
sin('arg'*exp(9))'
\$\endgroup\$
3
\$\begingroup\$

bc, abligh

Merely inserted the math operators. Took about 1 minute to solve once I looked up what bc was and what math operations it had. The first thing I thought of was division, but there weren't common factors that looked nice. So I immediately went for exponentiation and modulus. At least 15 digits were necessary for the modulus b/c of the expected output. After that, I guessed twice and found it.

4518^574%615489737231532
\$\endgroup\$
3
\$\begingroup\$

Lua, TreFox

Description

"_G" is the global table, making "_G.load" refer to the global function "load". Converting a function to a string results in returning the function's address, which is then made into the length of the string by the length-operator "#".

Code

G={load="lfkjgGsHjkU83fy6dtrg"}
print(#tostring(_G.load))

Also, since this is my first post on here, I can't make a comment on the original answer.

\$\endgroup\$
4
  • \$\begingroup\$ I've left a comment on the cop answer. By the way, this doesn't quite work for me. The address is I get is 0x321a40c6d0, for a final output of 22. \$\endgroup\$
    – Dennis
    Aug 14, 2015 at 3:35
  • \$\begingroup\$ I am not sure why you are getting 22... on everything I tested it was 18 or 26. \$\endgroup\$
    – Nico A
    Aug 14, 2015 at 11:29
  • \$\begingroup\$ @Dennis Try it in the official lua demo. \$\endgroup\$
    – Xrott
    Aug 14, 2015 at 13:10
  • \$\begingroup\$ Aha, I was so close! I knew I needed the global load, and I knew _G referred to the global symbol table... I just didn't put the two together. \$\endgroup\$ Aug 14, 2015 at 16:39
3
\$\begingroup\$

Python, rp.beltran

Description

I noticed that the needed letters were always 2 in front of a digit. changing the third \w to \d got all of the right letters except the spaces. \D was the only \ group I could find that allowed letters and spaces.

Code

import re;''.join(re.findall('\D(?=\w\d)','t74q joh7 jv f9dfij9j bfjtf0e nnjen3j nnjrb6fgam3gtm5tem3hj s3eim7djsd3ye d5dfhg5un7ljmm8nan3nn6n k m2ftm5bsof5bf r5arm4ken8 adcm3nub0 nfrn6sn3jfeb6n d m6jda5 gdif5vh6 gij7fnb2eb0g '))

w -> D, w -> d in the regex.

\$\endgroup\$
3
\$\begingroup\$

Pyth, isaacg

Description

The original code does the following:

 CG      Convert "abcdefghijklmnopqrstuvwxyz" from base 256 to integer, yielding
         156490583352162063278528710879425690470022892627113539022649722.
   ^3y21 Compute 3^(2 * 21).
%        Calculate the modulus.

Since 156490583352162063278528710879425690470022892627113539022649722 - 58227066 gives 156490583352162063278528710879425690470022892627113538964422656, which equals 226 × 3 × 7 × 7477 × 381524422711 × 17007550201751761 × 2288745700077000184147, the desired output can be obtained by replacing ^3y21 with something that evaluates to a divisor of this product and is larger than 58227066.

The ^ in the original code suggests that we might use it to calculate a power of 2, the 3 that we could calculate a fitting divisor of the form 3 × 2n.

Both are misleading. Solutions with a Levenshtein distance of 3 (%CG^2 26, %CG^y2 13, %CG^4y13) or 4 (%CG.<3y13) are readily found, but the solution at distance 2 requires a different approach.

The lowercase alphabet (G) has 26 letters, so its power set (the set of all strictly increasing sequences of lowercase letters) has 226 elements. By replacing y2 with yG, we compute this power set.

We can retrieve the set's length by replacing 3 with l, which leaves us with ^lyG1, i.e., 226 raised to the first power.

Code

%CG^lyG1

Note that this will only work on a computer with enough available memory (roughly 6.43 GiB, according to time), so it will not work with the online interpreter.

Here's how you can verify the results from the command line:

$ \time -v pyth -c '%CG^lyG1'
58227066
        Command being timed: "pyth/pyth.py -c %CG^lyG1"
        User time (seconds): 30.73
        System time (seconds): 2.12
        Percent of CPU this job got: 100%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:32.85
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 6742564
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 2269338
        Voluntary context switches: 1
        Involuntary context switches: 58
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
\$\endgroup\$
1
  • \$\begingroup\$ Correct! Well done. \$\endgroup\$
    – isaacg
    Aug 15, 2015 at 0:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.