13
\$\begingroup\$

This is a Cops and Robbers challenge. For the Robbers' thread, go here.

The Cops have three tasks.
1) Pick a sequence from the OEIS.

2) Pick a language (this is suggested to be a golflang, but doesn't have to be) that, when given input n, outputs A(n) (where A(n) is the sequence chosen) using all usual rules.
Call this language LA and code CA.
For example, Jelly and Jelly_code.

3) Then, pick a different language (this is suggested to be a non-golflang, but doesn't have to be) and write code that takes no input and outputs code CA, again following all usual rules. (Note: this can be obfuscated code and doesn't necessarily need to be golfed, but the longer this code is the easier it will be for the robbers to crack your submission.)
Call this language LB and code CB.
For example, Python and Python_code.

The Cop's submission to this challenge is the sequence (specified whether 0- or 1-indexed), the name of the two languages LA and LB (and which one solves which part), and the byte-count of CB only. Keep the actual code of both parts, and the length of CA, secret.

For the Cop, links to documentation for LA and LB, or an interpreter (or a TIO link, since that includes both), are appreciated but not required.

The Robber's challenge is to select a Cops' entry and write code CC in the same LB language that outputs some code in the same LA language that solves the original OEIS task. The length of CC can be no longer than the length of CB as revealed by the cop (though may be shorter). Note: The code produced by CC does not have to match CA.

For our example, this means that the Robber has to write Python code that outputs Jelly code that solves the original OEIS sequence, and that Python code has to be no longer than the length revealed by the Cop.

Winning conditions

Answers that have not been cracked in a week can have their solutions revealed, at which point they are considered Safe. Note that if you don't reveal your solution after a week, it can still be cracked. The Cop with the shortest Safe answer wins.

\$\endgroup\$
3
  • \$\begingroup\$ Reminds me of codegolf.stackexchange.com/q/128065/46066 \$\endgroup\$
    – Joseph
    Commented Jun 7, 2018 at 14:06
  • \$\begingroup\$ Do we keep the OEIS sequence secret? \$\endgroup\$
    – Joseph
    Commented Jun 7, 2018 at 14:08
  • \$\begingroup\$ @juniorRubyist No, the Cop must state which sequence they used, and whether it's 0- or 1-indexed. \$\endgroup\$ Commented Jun 7, 2018 at 14:14

6 Answers 6

3
\$\begingroup\$

OEIS A000041, cracked by ETHproductions

Let's try it the other way around: golflang generates non-golflang.

a(n) = number of partitions of n (the partition numbers).

  • a(n) (0-indexed) is returned by a JavaScript function (ES6)
  • The program that outputs the JS function is written in Jelly
  • The length of the Jelly program is 35 bytes

Intended solution

Jelly: “¦ṚoIwƭ- ḊFæSḂ¥¶Ẉ|ḊJƓƝʋnrB⁾’b28+40Ọ

which outputs

JS: C=(A,B=A)=>A<0?0:A?B?C(A,B-1)+C(A-B,B):0:1

\$\endgroup\$
3
  • \$\begingroup\$ Cracked. That was quite fun, although I seem to have lost a couple of hours :-) \$\endgroup\$ Commented Jun 6, 2018 at 22:31
  • \$\begingroup\$ @ETHproductions Nice! My JS solution was using a restricted range of characters so that it can be compressed as a base-28 integer on the Jelly side. \$\endgroup\$
    – Arnauld
    Commented Jun 7, 2018 at 6:03
  • \$\begingroup\$ @ETHproductions Man, I should have spent more time optimizing the JS code. Here is a 31-byte solution. ¯\_(ツ)_/¯ \$\endgroup\$
    – Arnauld
    Commented Jun 7, 2018 at 6:35
2
\$\begingroup\$

OEIS A048272, cracked by DJMcMayhem

Number of odd divisors of n minus number of even divisors of n (1-indexed).

  • The program that outputs a(n) is written in 05AB1E.
  • The program that outputs the 05AB1E program is written in Brain-Flak + the -A flag.
  • The length of the Brain-Flak program is 198 bytes (the byte count does not include the flag).

Note that I could probably easily golf the Brain-Flak program by using stack-manipluation tricks and other kolmogorov-complexity tricks I am aware of, but I wanted to keep this simple as my first submission. Good luck, robbers!

What I had in mind

05AB1E: ÑÈD<)O(O

Brain-Flak: (((((((((((()()()){}){}){({}[()])}{}())[((((()()()){}){}())){}{}])((((()()()){}){}())){}{})[((((()()()){}){})()){}{}])(((()()()){})){}{}())(()()()()){})(((((()()()()){}){}){}()){}){})((()()())){}{})

\$\endgroup\$
3
  • \$\begingroup\$ Cracked \$\endgroup\$
    – DJMcMayhem
    Commented Jun 6, 2018 at 17:58
  • \$\begingroup\$ @DJMcMayhem :( I just finished \$\endgroup\$
    – hyperneutrino
    Commented Jun 6, 2018 at 17:58
  • \$\begingroup\$ @DJMcMayhem Nice! I'll try something a bit harder next. \$\endgroup\$
    – Mr. Xcoder
    Commented Jun 6, 2018 at 17:59
2
\$\begingroup\$

OEIS 000035, cracked by betseg

The problem is solved in Proton.
The Proton code is output by Python.
The length of the Python program is 13 bytes.

Really easy one for starters (if you know Proton :D). Zero-indexed.

Intended Solution

Python: print("(2%)")
Proton: (2%)
Though I decided to let n=>n%2 be short enough because dyadic/monadic function shortcuts are not documented.

\$\endgroup\$
5
  • 8
    \$\begingroup\$ Really easy one if you know a language which appears to have precisely zero documentation. Yeah, great. \$\endgroup\$ Commented Jun 6, 2018 at 15:45
  • 3
    \$\begingroup\$ Why is the link to A34 ... \$\endgroup\$
    – user202729
    Commented Jun 6, 2018 at 16:13
  • \$\begingroup\$ cracked \$\endgroup\$
    – betseg
    Commented Jun 6, 2018 at 16:35
  • \$\begingroup\$ @user202729 fixed thanks \$\endgroup\$
    – hyperneutrino
    Commented Jun 6, 2018 at 17:01
  • \$\begingroup\$ @PeterTaylor precisely zero there's enough here for you to solve it... \$\endgroup\$
    – hyperneutrino
    Commented Jun 6, 2018 at 17:02
2
\$\begingroup\$

OEIS A000034 (cracked by H.PWiz)

1, 2, 1, 2, 1, 2, 1, 2, …

Period 2: repeat [1, 2]; a(n) = 1 + (n mod 2).

a(n) is the output of a Haskell answer, which is the output of a 32-byte Malbolge answer.

\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$
    – H.PWiz
    Commented Jun 17, 2018 at 17:04
1
\$\begingroup\$

OEIS A055642, cracked by Lynn

Number of digits in decimal expansion of n

This is probably too easy, but it took me a while so I hope someone out there will be just as disappointed as I was when I finally figured it out :D

  • The program that writes out a(n) is written in 05AB1E
  • The program that prints the 05AB1E program is written in TeX
  • The TeX program is 6 bytes long

What I had in mind:

Sg as 05AB1E code
Sg\bye as TeX code

\$\endgroup\$
2
  • \$\begingroup\$ Cracked? \$\endgroup\$
    – lynn
    Commented Jun 17, 2018 at 13:45
  • 1
    \$\begingroup\$ @Lynn yes. How disappointed were you? \$\endgroup\$ Commented Jun 17, 2018 at 13:57
1
\$\begingroup\$

OEIS A000668, cracked by Lynn

Mersenne primes (of form 2p-1 where p is a prime)

  • a(n) is outputted by a Jelly full program.
  • n is 1-indexed.
  • The Jelly program is printed by a Triangularity program, whose length is 38 bytes.

Different strategy: solve the sequence in a golflang and output the program in an esolang.

Intended solution

\$\endgroup\$
3
  • \$\begingroup\$ Are you sure the length is correct? The docs say a Triangularity program must have length 2*n^2 - 1 which can't be 38. \$\endgroup\$
    – lynn
    Commented Jun 17, 2018 at 14:03
  • 1
    \$\begingroup\$ @Lynn That refers to character count, not byte count. \$\endgroup\$
    – Mr. Xcoder
    Commented Jun 17, 2018 at 14:03
  • \$\begingroup\$ Cracked! \$\endgroup\$
    – lynn
    Commented Jun 17, 2018 at 15:49

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.