25
\$\begingroup\$

The cops thread can be found here: The Mystery String Printer (Cops)

Your challenge

  • Choose a submission from the cops thread, and print out the string from an answer in that thread.
  • The submission that you choose must not be safe (it must be newer than 7 days).
  • Your program, function, or REPL script needs to follow the same rules as the cops thread. Just to recap:

    • Your program must be ≤128 characters (if a cop's submission is in a smaller range of program lengths, your program must also be in that length range. For example, if a cop's program is ≤32 bytes, your program must be ≤32 bytes).
    • The program must produce the same output every time it is run.
    • No cryptographic functions.
    • The program must not take input.
    • No standard loopholes.
  • All new submissions must use the same language. Submissions from before this rule was made are fine, even if they don't.

Scoring

Scoring works similarly for robbers, but it is slightly different:

  • Cracking any program of ≤8 bytes gives 1 point.
  • Cracking a ≤16 byte program gives 2 points. ≤32 bytes gives 4 points, and so on.
  • Every additional submission, no matter the length, earns +5 points
  • Each cop's submission can only be cracked once- only the first person to crack each submission gets the points.

Submissions

Each answer must include

  • A link to the cop's submission.
  • Your program and programming language.
  • Also have the cop's program length (as a power of 2) as the last number in your header.

Additionally, please comment on the cop's submission with a link to your answer.

Here is a Stack Snippet to generate leaderboards. Please leave a comment if there is a problem with the snippet. If you would like to see all open cop submissions, see the snippet in the cops' challenge.

/* Configuration */

var QUESTION_ID = 60329; // Obtain this from the url
// It will be like http://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";

/* App */

var answers = [],
  answers_hash, answer_ids, answer_page = 1,
  more_answers = true,
  comment_page;

function answersUrl(index) {
  return "//api.stackexchange.com/2.2/questions/" + QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "//api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {

  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function(data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });

}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function(data) {
      data.items.forEach(function(c) {

        answers_hash[c.post_id].comments.push(c);

      });

      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var POINTS_REG = /(?:<=|≤|&lt;=)\s?(?:<\/?strong>)?\s?(\d+)/
var POINTS_REG_ALT = /<h\d>.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;


function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {

  var valid = [];
  var open = [];

  answers.forEach(function(a) {

    var body = a.body;
    var cracked = false;

    var points = body.match(POINTS_REG);
    if (!points) points = body.match(POINTS_REG_ALT);

    if (points) {
      var length = parseInt(points[1]);
      var crackedpoints = 0;
      if (length > 64) crackedpoints = 16;
      else if (length > 32) crackedpoints = 8;
      else if (length > 16) crackedpoints = 4;
      else if (length > 8) crackedpoints = 2;
      else crackedpoints = 1;

      valid.push({
        user: getAuthorName(a),
        numberOfSubmissions: 1,
        points: crackedpoints

      });
    }
  });

  var pointTotals = [];
  valid.forEach(function(a) {

    var index = -1;
    var author = a.user;
    pointTotals.forEach(function(p) {
      if (p.user == author) index = pointTotals.indexOf(p);
    });

    if (index == -1) pointTotals.push(a);
    else {
      pointTotals[index].points += a.points;
      pointTotals[index].numberOfSubmissions++;
    }

  });

  pointTotals.forEach(function(a) {
    a.points += +((a.numberOfSubmissions - 1) * 5);
  });

  pointTotals.sort(function(a, b) {
    var aB = a.points,
      bB = b.points;
    return (bB - aB != 0) ? bB - aB : b.numberOfSubmissions - a.numberOfSubmissions;
  });

  pointTotals.forEach(function(a) {


    var answer = jQuery("#answer-template").html();
    answer = answer
      .replace("{{NAME}}", a.user)
      .replace("{{SUBMISSIONS}}", a.numberOfSubmissions)
      .replace("{{POINTS}}", a.points);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);


  });

}
body {
  text-align: left !important
}
#answer-list {
  padding: 20px;
  width: 240px;
  float: left;
}
#open-list {
  padding: 20px;
  width: 450px;
  float: left;
}
table thead {
  font-weight: bold;
  vertical-align: top;
}
table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="answer-list">
  <h2>Robber's Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr>

        <td>Author</td>
        <td>Submissions</td>
        <td>Score</td>
      </tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>

<table style="display: none">
  <tbody id="answer-template">
    <tr>
      <td>{{NAME}}</td>
      <td>{{SUBMISSIONS}}</td>
      <td>{{POINTS}}</td>
    </tr>
  </tbody>
</table>

This contest is now closed.

Overall winner: kennytm

Most submissions: Sp3000

(Note that the amount of submissions doesn't translate exactly to the points, as the length of the cracked program is counted when calculating the score).

\$\endgroup\$
1
  • \$\begingroup\$ Note: every additional submission earns 5 points \$\endgroup\$
    – Daniel M.
    Commented Oct 12, 2015 at 20:13

93 Answers 93

29
\$\begingroup\$

Pyth, Dennis, ≤ 8

V./Tp*FN

Damn that was fun - the hardest part was figuring out how to do it short enough in Pyth.

Analysis

The 1234 at the start hints that we're probably dealing with a list of numbers, printed without a separator. Let's try and split the numbers up in a way that makes sense:

1 2 3 4 4 6 5 8 8 9 6 12 10 12 7 16 16 18 12 15 16 8 24 20 24 14 27 18 20 9 32 32 36 24 30 32 16 36 21 24 25 10

There's a few hints that we're on the right track:

  • All numbers have prime factors less than 10
  • A lot of numbers are pretty close to their index in the list

However, there are a few peculiarities. The number at index 23 is 24, and is the only case where the number at the index is greater than the index itself. However, the bigger clue is that some numbers are clearly smaller than their neighbours, particularly the 7 at index 15, the 8 at index 22 and the 9 at index 30.

Noting that this forms a 7-8-9 pattern, we can also see that the last number is a 10 at index 42. Given @Dennis' recent question on abelian groups, a quick check on OEIS reveals that 15, 22, 30, 42 is a subsequence of the partition numbers. Pyth has a builtin for partitions, which gives us two of eight characters: ./

But note that the last number is 10, which is suspicious because 10 is a preinitialised variable in Pyth, as T. ./T gives a full list of the 42 partitions of the number 10, which looks like it might come in handy.

Now the printing is done without a separator, so this hints at a use of p. Perhaps we loop through each partition, do something to it, then print with p? This gives us the following template:

V./Tp??N

where V is a for loop which loops over an iterable, storing each element in the variable N.

A quick look at the second last partition (5, 5) should make it obvious that we want to take a product. The naive way to reduce a list by multiplication is

u*GHd1

where d is the list in question. However, this is far too long.

Unfortunately, this is where I had to pull out a brute forcer. I haven't kept up with Pyth for a while, so I didn't know many of the newer features. There were only two characters left, which looked entirely doable.

The brute forcer then returned:

V./Tp*FN

where *F is fold by * (multiplication). No wonder I didn't find it in my search - I was looking up the keyword "reduce" rather than "fold"!

\$\endgroup\$
2
  • 4
    \$\begingroup\$ Even possible in 7: jk*M./T \$\endgroup\$
    – Jakube
    Commented Oct 11, 2015 at 7:39
  • \$\begingroup\$ @Jakube Oh wow, if the range had been <= 7 I would have been doomed. It sure has been a while since I've checked out the language. \$\endgroup\$
    – Sp3000
    Commented Oct 11, 2015 at 7:43
9
\$\begingroup\$

><>, VTCAKAVSMoACE, ≤ 64

'9?':?!;1-$:'@'+o'3'*'='%$30.

Ironically, not only is this much lower the range limit, it's also portable and works with the online interpreter.

Analysis

Let's start with the target string:

yh[cPWNkz^EKLBiQMuSvI`n\Yw|JVXDUbZmfoRC_xrq{TlpHjGt]OadFAsgeyh[

><> pushes chars to the stack with ' or " in string mode, but with 63 chars to print and only 64 bytes to work with, the presence of capital letters (invalid instructions in ><>, for the standard looparound trick) make direct printing impossible. Hence, we must be doing something with the code points.

Converting to code points gives (I'm using Python here):

>>> L = [ord(c) for c in "yh[cPWNkz^EKLBiQMuSvI`n\Yw|JVXDUbZmfoRC_xrq{TlpHjGt]OadFAsgeyh["]
>>> L
[121, 104, 91, 99, 80, 87, 78, 107, 122, 94, 69, 75, 76, 66, 105, 81, 77, 117, 83, 118, 73, 96, 110, 92, 89, 119, 124, 74, 86, 88, 68, 85, 98, 90, 109, 102, 111, 82, 67, 95, 120, 114, 113, 123, 84, 108, 112, 72, 106, 71, 116, 93, 79, 97, 100, 70, 65, 115, 103, 101, 121, 104, 91]

Note that the last three numbers are the same as the first three. This hints at a possible modulo loop going on.

Let's take a look at how many different elements we have:

>>> len(set(L))
60

We have 63 elements in L, the first three of which coincide with the last three. This means that, aside from this collision, all other elements are unique. Now this hints at something like taking powers modulo a prime number. Indeed, 60 + 1 = 61 is prime, which is a good sign.

Let's try finding the smallest element

>>> min(L)
65

and use that to scale all the elements down so that the min element is 1:

>>> M = [x-64 for x in L]
>>> M
[57, 40, 27, 35, 16, 23, 14, 43, 58, 30, 5, 11, 12, 2, 41, 17, 13, 53, 19, 54, 9, 32, 46, 28, 25, 55, 60, 10, 22, 24, 4, 21, 34, 26, 45, 38, 47, 18, 3, 31, 56, 50, 49, 59, 20, 44, 48, 8, 42, 7, 52, 29, 15, 33, 36, 6, 1, 51, 39, 37, 57, 40, 27]

Note how the element after 1 is 51. If there's some sort of powers/multiplication thing going on, this is a good guess for our multiplier.

Let's give it a shot:

>>> (57*51)%61
40
>>> (40*51)%61
27
>>> all((x*51)%61 == y for x,y in zip(M, M[1:]))
True

Bingo! We can now backtrack, giving the following code:

x = 57
for _ in range(63):
    print(chr(x + 64), end="")
    x = (x*51)%61

which was then translated to ><>

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Interestingly, this is dissimilar many ways to what I did - I used 37 and 112 (meant to use 101, but made a mistake in the code. Epic fail) as a continued multiplication set and modulo'd with 63, then added 64 to get into a readable ASCII range. +1 Well done. \$\endgroup\$ Commented Oct 11, 2015 at 14:39
  • \$\begingroup\$ Very nice, wish I could do that ;) \$\endgroup\$
    – J Atkin
    Commented Oct 12, 2015 at 21:24
9
\$\begingroup\$

Mathematica, alphalpha, ≤ 32

GroupOrder[MonsterGroupM[]]

I hate to say this, but I just recognised the number on the spot.

\$\endgroup\$
2
  • 3
    \$\begingroup\$ Even shorter: 31!10!27079205916672 \$\endgroup\$
    – kennytm
    Commented Oct 13, 2015 at 3:50
  • 2
    \$\begingroup\$ Dammit, I knew that number looked familiar. \$\endgroup\$
    – Dennis
    Commented Oct 13, 2015 at 3:56
8
\$\begingroup\$

Pyth, Maltysen, ≤4

C.ZG

Brute force took so long that I did it faster manually.

Analysis

C (convert string to base 256 int) is the easiest way to generate a large number in Pyth, so it's probably the first character. If we convert from base 256, we get:

xÚKLJNIMKÏÈÌÊÎÉÍË/(,*.)-+¯¨¬ 

Hmm... not very illuminating.

Now G is the alphabet string "abc...z", which looks like it could be a source for a long string to feed into C. Looking through the docs I find:

.Z    Compresses or decompresses a string.

If we're dealing with compression here, it wouldn't be surprising to get all sorts of extended ASCII characters. Trying C.ZG then gave the answer.

\$\endgroup\$
6
\$\begingroup\$

Fourier, Beta Decay, ≤ 32

2~x1~y20(xoy~z*x~yz~xq^~q)

Or alternatively, in CJam:

X0I{_2$+}*]2\f#

Analysis

At the start we can see a lot of powers of 2:

2
1
2
2
4
8
32
256
8192
2097152
...

If we take the log base 2 of these numbers, we get:

1 0 1 1 2 3 5 8 13 21 ...

which is the Fibonacci series, starting at 1, 0.

\$\endgroup\$
6
\$\begingroup\$

Snails, feersum, ≤2 bytes

z

This is actually 2 bytes; the character z followed by a newline \n.

I have no idea how it works or what it's doing, but after testing all possible inputs apart from ~+ and ~,, this was the only 2-byte program that produced 8 as output.

And it took ages to get this result. No wonder it's called "Snails" :-D


Note to self: The next time you fuzz test unknown software, do it inside a VM.

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

Rust, Liam Noronha, ≤128 bytes

fn main(){print!("AACAAEGAAACIIMOAAACAAEGQQQSYYDFAAACAAEGAAACIIMOHHHJHHLNXXXAGGKMAAACAAEGAAACIIMOAAACAAEGQQQSYYDFOOO");}

Simply printing the string verbatim is 120 bytes...

\$\endgroup\$
1
  • 1
    \$\begingroup\$ wow it was late when I did that. So dumb sorry. I could have made the text considerably longer with no effort. I'll post the actual source. \$\endgroup\$
    – Liam
    Commented Oct 11, 2015 at 20:51
5
\$\begingroup\$

Macaroni 0.0.2, Doorknob, ≤64

set x "................................."print x print x print x
\$\endgroup\$
5
\$\begingroup\$

Python 2, Clear question with examples, <=64

One possible solution:

print ''.join([" `{.~{{~||"[int(c)] for c in str(3**4278)])

(9**2139, 27**1426 and 729**713 also give the same result)

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

CoffeeScript, user2428118, ≤64

alert 0+(btoa k.substr -2 for k of document.body.style).join ''

(works only on Chrome 46.0.2490.71 as described by the Cop.)


The output is obviously a concatenation of short base64-encoded strings due to all the "=". After decoding them, we find a list of 2-character strings like

['nt', 'ms', 'lf', 'ne', 'll', 'on', 'ay', 'on', …

which does not seem to make sense. But I find some odd items in it, like nX and tY. After filtering these out we get

>>> # Python
>>>
>>> [i for i in tt if not re.match('[a-z]{2}$', i)]
['nX', 'nY', 'tX', 'tY', 'wX', 'wY', 'r', 'nX', 'nY', 'tX', 'tY', 'nX', 'nY', 'nX', 'nY', 'nZ', 'x', 'y']

These X and Y seem to indicate the original source code used position properties like offsetX/Y. A particularly interesting is the nZ item. To check my assumption, I searched for all properties that end with "Z":

// CoffeeScript
checked = []
f = (o) ->
    if !(o in checked) 
        for k of o
            if /Z$/.test(k)
                console.log(o, k)
            if o[k] instanceof Object
                f o[k]
f window

which shows tons of CSSStyleDeclaration, "webkitTransformOriginZ". From this we have a strong indication that the list is built up by the last 2 characters of all the keys of a style object, which the test above shows indeed is correct.

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

Python 2, histocrat, ≤16

[[[51002**3/6]]] 

The biggest hint is the promise that it won't work in Python 3. What's changed in Python 3? The biggest suspect is that the division operator returns a float in Python 3.

So I assume the solution is of the form ⌊αβ/n⌋ = c = 22111101102001, as exponentiation is the only short way to create huge numbers.

If {α, β, n} indeed forms a solution, then (cn)1/β ≈ α should be very close to an integer. Therefore I use the following to try to brute-force the {α, β} for each n:

(* Mathematica *)
n=2; Sort[Table[{N[Abs[k - Round@k] /. k -> (22111101102001*n)^(1/b), 12], b}, {b, 2, 50}]]

(* Output: {{0.00262542213622, 7}, ...}

   The first number is the "quality" of the solution, lower is better.
   the second number is β.
   Thus α ≈ (nc)^(1/β) = 89
   But (89^7)/2 = 22115667447764, which is still far away from the answer.

*)

The actual result quickly comes out when n = 6.

\$\endgroup\$
1
  • \$\begingroup\$ Well done! That's the intended solution, and about how I expected someone would solve it (although I didn't realize ahead of time just how platform-dependent it was). \$\endgroup\$
    – histocrat
    Commented Oct 19, 2015 at 20:11
4
\$\begingroup\$

MATLAB, StewieGriffin, ≤ 16

[36;87]*' |'*5

Prints:

ans =
        5760       22320
       13920       53940
\$\endgroup\$
3
  • \$\begingroup\$ Nice! Glad you liked it :-) the way I did it: 5*'$W'.'*' |'. \$\endgroup\$ Commented Oct 12, 2015 at 5:25
  • \$\begingroup\$ I was considering making it a lot harder by multiplying by e.g. .73 instead of 5, do +5, or make it a 3x3 matrix but figured this was more fun. Could have done a lot with the three remaining bytes. \$\endgroup\$ Commented Oct 12, 2015 at 5:34
  • \$\begingroup\$ @StewieGriffin Never come across .' before, but makes complete sense - was wondering how to transpose a string without resorting to brackets. \$\endgroup\$ Commented Oct 12, 2015 at 14:22
4
\$\begingroup\$

Matlab, Luis Mendo, ≤16

I found it, yay!

fix(peaks(9).^2)

I didn't know that Octave can do this, too.

\$\endgroup\$
2
  • \$\begingroup\$ How? Had you heard of peaks()? \$\endgroup\$
    – lirtosiast
    Commented Oct 12, 2015 at 14:00
  • \$\begingroup\$ Yes, I have. I have by hazard been playing around with peaks. \$\endgroup\$
    – Wauzl
    Commented Oct 12, 2015 at 16:42
4
\$\begingroup\$

Mathematica, LegionMammal978, ≤64

Print@Nest[Compress,ExampleData[{"Text","ToBeOrNotToBe"}],13]
\$\endgroup\$
4
\$\begingroup\$

Python, spacemanjosh, ≤ 64

n=0;d=1;L=[]
exec("L+=[10/(100-n)**.5];n+=d;d+=2;"*10)
print(L)

Glorious inverse symbolic calculator. Not well golfed, but hey it fits.

Edit: I golfed it.

print([10/(100-n*n)**.5for n in range(10)])
\$\endgroup\$
4
\$\begingroup\$

JavaScript ES6, Cᴏɴᴏʀ O'Bʀɪᴇɴ, ≤128 bytes

var x=122,s='0037122342526683102122';for(var i=23;i<=505;i+=2)s+=(x+=i);s;

I doubt this is exactly right since I didn't need anywhere near 128 bytes, but finding a repeating sequence was fun challenge.

\$\endgroup\$
3
  • \$\begingroup\$ Wow. I used a completely different method. Does that still count? :3 \$\endgroup\$ Commented Oct 13, 2015 at 17:40
  • \$\begingroup\$ @CᴏɴᴏʀO'Bʀɪᴇɴ Usually does. I'm really curious about the original and what produces those first 22 bytes though, I'd guess something funky in the loop init \$\endgroup\$
    – SLuck49
    Commented Oct 13, 2015 at 19:15
  • \$\begingroup\$ I'll post it when I get the time. I think its the flooring of the function s * s - s/(5-s) \$\endgroup\$ Commented Oct 13, 2015 at 19:17
4
\$\begingroup\$

Thue, ppperry, <=64

0::=11
1::=22
2::=33
3::=44
4::=55
a::=bbb
b::=000
::=
aaaaaaa

Decomposes 2016 into its prime factors, essentially. 62 characters, so my guess is this is similar to what you were going for.

\$\endgroup\$
2
  • \$\begingroup\$ You can do 0::=2222 to save some bytes. \$\endgroup\$
    – lirtosiast
    Commented Oct 13, 2015 at 22:31
  • \$\begingroup\$ Fair point, seems a bit less elegant though. \$\endgroup\$
    – histocrat
    Commented Oct 13, 2015 at 23:02
4
\$\begingroup\$

Python, DLosc, ≤32

(This solution uses Python 2)

a=97
while a<4e31:a^=a*2;print a
\$\endgroup\$
4
\$\begingroup\$

><>, Sp3000, <=8

'l(?; o>

The instruction pointer wraps around and the following steps happen:

  • 'l(?; o>' pushes the ASCII values of l(?; o> to the stack
  • l pushes the size of the stack on the stack
  • ( compare the top two stack elements: size of stack and ord('>')
  • ?; stops the program if the stack size was bigger
  • o output the top element of the stack as character (this will be always o)
  • > sets IP direction, here it is no-op
  • we go back to the first step

Output is oooooooooooo.

We can get a lot of different outputs by changing [space] to something which pushes or pops on the stack and using another valid character instead of >, which may also push or pop.

\$\endgroup\$
1
  • \$\begingroup\$ Nice! For reference, I had: 'l=?;o* \$\endgroup\$
    – Sp3000
    Commented Oct 15, 2015 at 16:03
4
\$\begingroup\$

JavaScript, ev3commander, ≤ 32

console.log(0.1411200080598672)

OK, that was easy.

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

CJam, Reto Koradi, ≤ 4

HJK#

Pushes 17, then 1920 = 37589973457545958193355601.

Try it online.

There are only so many things you can do in four bytes. An integer this big had to involve powers or factorials somehow, and a factorial would have trailing zeroes.

\$\endgroup\$
1
  • \$\begingroup\$ That's correct. I'll handle the official post update later today. \$\endgroup\$ Commented Oct 16, 2015 at 18:14
4
\$\begingroup\$

Lua <= 4, Egor Skriptunoff

A lot of users were getting agitated about this answer in chat, so I must relieve them from their misery. I don't know Lua and wasn't able to test it, but I would be very surprised if this doesn't work.

4^~9

This would be pretty obvious, but probably no one got it because bitwise operators were only added in version 5.3; ideone.com only has version 5.2.

\$\endgroup\$
1
  • \$\begingroup\$ facepalm I overlooked bitwise operators because they only use integers. \$\endgroup\$ Commented Oct 18, 2015 at 18:53
4
\$\begingroup\$

Pyth <= 4, Dennis

ljyG

That's length of join on newlines of all subsets of the alphabet.

Test run:

$ pyth -cd 'ljyG'
==================== 4 chars =====================
ljyG
==================================================
imp_print(Plen(join(subsets(G))))
==================================================
939524095

I figured out the number was 2^27 * 7 - 1 which is a strong hint that it's based on yG, which is 2^26 elements long. I then guessed it had to be converted to a string and its length printed. However, the only way of doing this I could think of for a while was ``, repr. Then I thought of j, which fits perfectly.

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

C, tucuxi, ≤64

main(i){for(i=0;i<11000;++i)if(!(i&2*i))printf("1%d",!(i&1));}

The output are all 0 and 1, but C cannot print binary directly, so it's very likely these are boolean results.

There are more 1 than 0s, so I recorded the positions of 0s (3, 9, 13, 19, …), which turns out to be OEIS A075318. This is not useful though, there isn't a simple formula to determine where a number is in this sequence.

But we note that there are all odd numbers, so perhaps (x-1)/2 = {1, 4, 6, 9, 12, …} have more useful information. And this is A003622.

A003622 can be defined as "positions of 1's in A003849", which is exactly what we need to crack here. And A003849 is defined as "A003714 mod 2", where A003714 are simply all integers that x & (2*x) == 0. Thus we have got the solution.

OEIS rox.

\$\endgroup\$
1
  • \$\begingroup\$ truly impressive - I never cease to be surprised by the this site's users \$\endgroup\$
    – tucuxi
    Commented Oct 19, 2015 at 16:59
4
\$\begingroup\$

Dyalog APL, Dennis, ≤4

*⍨⍟8

Computes ln(8)^ln(8). Would StackExchange stop converting my answers? I'll type a bunch of stuff here so it doesn't get turned into a comment.

\$\endgroup\$
1
  • \$\begingroup\$ I had 8*⍟⍟8 but didn't know about . Nice work :) \$\endgroup\$
    – Sp3000
    Commented Oct 22, 2015 at 8:23
3
\$\begingroup\$

Pyth, xnor, ≤ 4

C`CG

CG (convert the alphabet string "abc...z" from base 256) is the typical Pyth way of generating a really large number. After that it's just stringify and convert from base again.

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

Ruby, Doorknob, ≤64

'@@'=~/(.)(.)/
p$~
test 0 rescue p"#$!@@".gsub //,$!.inspect+$/
\$\endgroup\$
3
\$\begingroup\$

Matlab/Octave, Wauzl, ≤16

"234"'*"567"

Using the same idea as Tom Carpenter's answer

(If it did not work, try this:)

[50;51;52]*'567'
\$\endgroup\$
2
  • \$\begingroup\$ @NaN See update. Both are ≤16 bytes and work on ideone. \$\endgroup\$
    – kennytm
    Commented Oct 12, 2015 at 13:07
  • \$\begingroup\$ Nice. I had (1*'234')'*'567' in mind, because your first answer does not work in Matlab. \$\endgroup\$
    – Wauzl
    Commented Oct 12, 2015 at 13:26
3
\$\begingroup\$

CoffeeScript, J Atkin, ≤ 16

Math.PI*Math.LN2

Hooray for the inverse symbolic calculator.

\$\endgroup\$
2
  • \$\begingroup\$ Well, that was fast. \$\endgroup\$
    – lirtosiast
    Commented Oct 13, 2015 at 2:40
  • \$\begingroup\$ Ok, that was lame of me to try that ;) \$\endgroup\$
    – J Atkin
    Commented Oct 13, 2015 at 2:55
3
\$\begingroup\$

PARI/GP, alephalpha, ≤ 4

9!-9

I don't actually know the language, but that has to be the right answer.

\$\endgroup\$

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.