Golfing Chain (Cops' Thread)

13

2

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.

AdmBorkBork

Posted 2018-06-06T15:19:43.447

Reputation: 41 581

Reminds me of https://codegolf.stackexchange.com/q/128065/46066

– juniorRubyist – 2018-06-07T14:06:20.727

Do we keep the OEIS sequence secret? – juniorRubyist – 2018-06-07T14:08:08.300

@juniorRubyist No, the Cop must state which sequence they used, and whether it's 0- or 1-indexed. – AdmBorkBork – 2018-06-07T14:14:45.157

Answers

3

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

Arnauld

Posted 2018-06-06T15:19:43.447

Reputation: 111 334

Cracked. That was quite fun, although I seem to have lost a couple of hours :-) – ETHproductions – 2018-06-06T22:31:42.460

@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. – Arnauld – 2018-06-07T06:03:48.470

@ETHproductions Man, I should have spent more time optimizing the JS code. Here is a 31-byte solution. ¯\(ツ)

– Arnauld – 2018-06-07T06:35:01.233

2

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.

HyperNeutrino

Posted 2018-06-06T15:19:43.447

Reputation: 26 575

7Really easy one if you know a language which appears to have precisely zero documentation. Yeah, great. – Peter Taylor – 2018-06-06T15:45:29.187

3Why is the link to A34 ... – user202729 – 2018-06-06T16:13:58.020

cracked – betseg – 2018-06-06T16:35:05.570

@user202729 fixed thanks – HyperNeutrino – 2018-06-06T17:01:19.317

@PeterTaylor precisely zero there's enough here for you to solve it...

– HyperNeutrino – 2018-06-06T17:02:50.227

2

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: (((((((((((()()()){}){}){({}[()])}{}())[((((()()()){}){}())){}{}])((((()()()){}){}())){}{})[((((()()()){}){})()){}{}])(((()()()){})){}{}())(()()()()){})(((((()()()()){}){}){}()){}){})((()()())){}{})

Mr. Xcoder

Posted 2018-06-06T15:19:43.447

Reputation: 39 774

Cracked – James – 2018-06-06T17:58:09.360

@DJMcMayhem :( I just finished – HyperNeutrino – 2018-06-06T17:58:54.047

@DJMcMayhem Nice! I'll try something a bit harder next. – Mr. Xcoder – 2018-06-06T17:59:52.147

2

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.

Lynn

Posted 2018-06-06T15:19:43.447

Reputation: 55 648

Cracked – H.PWiz – 2018-06-17T17:04:05.773

1

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

Mr. Xcoder

Posted 2018-06-06T15:19:43.447

Reputation: 39 774

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. – Lynn – 2018-06-17T14:03:12.307

1@Lynn That refers to character count, not byte count. – Mr. Xcoder – 2018-06-17T14:03:49.890

Cracked! – Lynn – 2018-06-17T15:49:41.883

1

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

Simon Klaver

Posted 2018-06-06T15:19:43.447

Reputation: 161

Cracked? – Lynn – 2018-06-17T13:45:11.257

1@Lynn yes. How disappointed were you? – Simon Klaver – 2018-06-17T13:57:21.740