Restricted mini challenges Cop's Thread

Your task as cops is to select three things:

• A programming language

• An OEIS sequence

• A byte set

You are then to secretly write a program in that language that computes the nth term sequence using only the bytes in the set. You will reveal the three pieces of information so that robbers can try to figure out the program.

Answers will be scored by the number of bytes in the byte set with more score being good. Cracked answers have an automatic score of 0. If your answer is uncracked after one week you may reveal the intended program and mark your answer as "safe".

Answers must be capable of calculating every term in the b-files of the sequence, but are not required to calculate any terms after.

Sequences can be either 1 or 0 indexed for both cops and robbers.

Here is a Python Script that checks if your code matches the given byte set.

• Lower score is better? Or higher? So in essence we're trying to find a restricted character set that makes it difficult for someone else to make a program in the chosen language, after we've already worked out a solution? Commented Jul 27, 2017 at 16:56
• Do we need to use all the bytes in our set? I would guess yes but it should probably be specified in the challenge. Commented Jul 27, 2017 at 17:06
• @Shaggy generally no, you can includes others for red herrings, but robbers can use everything Commented Jul 27, 2017 at 17:08
• Can robbers use the same byte twice or more? Commented Jul 27, 2017 at 17:19
• @Azulflame The b-files are files that are associated with each sequence the can be accessed by replacing the A with a b and appending a .txt. For example oeis.org/b4.txt would access the b-files for that sequence. Commented Jul 27, 2017 at 23:47

C, A027868 (Cracked)

I don't expect this to last too long...

Byte set: int (){reu<5?-:/;}

• cracked Commented Jul 28, 2017 at 23:11

R, A057077, (cracked)

1, 1, -1, -1, 1, 1, -1, -1, etc

Byte set:

()*/=2abcinopst

0-indexed.

• Commented Jul 31, 2017 at 14:04

JavaScript (ES6), A000035, cracked

A000035 is n mod 2, in case the site goes down or you're too lazy to check yourself. Charset:

023456789\efu

Taking the "somehow still Turing-complete" route. I suppose I could've added 51 or so non-ASCII chars to improve my score, but that feels kind of like cheating.

Takes input through prompt and outputs through alert, and can be run in any modern browser.

Intended solution:

\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0028\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0028\u0022\u0072\u0065\u0074\u0075\u0072\u006e\u0028\u0034\u0038\u0032\u002f\u0032\u0029\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0032\u0032\u0029\\u002\u0062\u0027\u0065\u0072\u0074\u0028\u0070\u0072\u006f\\u006\u0064\u0070\u0074\u0028\u0029\u0025\u0032\u0029\u0027\u0022\u0029\u0028\u0029\u0029\u0028\u0029

which, when the escapes are removed, translates to

FunctionFunction(Function("return(482/2).toString(22)\u002b'ert(pro\u006dpt()%2)'")())()

which simplifies again to

FunctionFunction(Function("return(482/2).toString(22)+'ert(prompt()%2)'")())()

This works because JavaScript allows \uXXXX escapes in variable names (though not in arbitrary code, as Java does). The outer Functioncode is necessary to run the code at all, since the entire thing needs to be escaped.

(If you're confused about how this works: JavaScript has something called tagged template literals, which for our purposes is just a function call on a string; it just uses fstring instead of f("code"). So Functioncode is about the same as Function("code")().)

Now, because of the lack of the hexadecimal chars 1abcd, we'll have to double-encode certain necessary characters such as the m in prompt(). So instead of \u006d, it becomes \\u006\u0064. But now we need to evaluate this as a string twice to make sure this gets fully decoded. (pro\u006dpt() would work just fine, but using \u002b as + would not.) This is what the second Function(code)() is for.

One further obstacle exists: there's no 1 in the charset, necessary to create an a from \u0061. So there's no way to generate an a by unescaping a string (I checked, the octal representation is \141). Instead, we can generate it with e.g. (20/2).toString(20). I went ahead and generated al in this manner because l would require double-escaping like m.

But the problem now is that the innermost Function call is now just generating a string. In order to actually execute it, we need to return it from the function and pass it to a third Function call. This we do, and finally our journey is complete.

*I am aware of using ${} within template literals, but those aren't in the charset, alright? • Cracked! Commented Aug 2, 2017 at 11:36 PowerShell, A000012, 19 bytes, SAFE$.0=[]acefilnorstv

Includes a newline and 18 other bytes. Good luck.

Try it online!

Intended Solution:

$a=$a[0]
$error[0].invocationinfo.offsetinline Try it online! This sets$a to be the value of an uninitialized variable $a indexed at [0]. Since that won't work, you get an error stating the following: Cannot index into a null array. At line:1 char:1 +$a=$a[0] + ~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray The second line then pulls the .InvocationInfo and .OffsetInLine (i.e., where the error occurred), which in this case is always 1, and hence the A000012 sequence. CPython 3.6.2, A000002 (cracked) I don't want anybody running out of single-character variables, so I'm giving you 70 pseudo-random characters courtesy of Latin-1. ·èõÉÀ]ýÜâô¾×l¡¿Ós¦Í½²uÊi´#¬©Åñ[);?ò à¢ådêøóÎÐþÒÏ®,(Öß.=Õc_ö\§éºún$tÞb¨

This is evil. You can't make a for loop. You can't make a while loop. You can't even try to do anything, much less except. I have given a new line so that you can use more than one statement, but there aren't any spaces, tabs or even colons to let you use any sort of flow control. There are no numbers. There are no strings. There is nothing of any use.

You do have \ and #, though, so you can write clear code with soft breaks and comments.

That is, if you speak Jelly.

• cracked with over 28kb of code Commented Aug 4, 2017 at 15:30
• @ppperry Congratulations. It is possible to get much smaller than that, though. Commented Aug 4, 2017 at 21:12
• I knew I was posting an unnecessarily long crack, but cracked is cracked, and it's only one day away from being safe. Commented Aug 4, 2017 at 21:22
• @ppperry Fair point. Nobody else is probably going to attempt it, so there's no point saying that it's suboptimal. Commented Aug 5, 2017 at 8:52
• @ppperry That's not supposed to be there... Oh well. Commented Aug 5, 2017 at 13:49

Python 2, A000142, cracked

Probably not too difficult, but since I really enjoyed solving these I thought I'll be a cop for once. Here's the byteset (first one is a space):

()*-:=abcdfghijklmoqruwyzABCDEFGHIJKLMNOPQRSTUVWXYZ

Intended solution

LyricLy's solution is much cleaner, but here's the one I had in mind:

Basically it's the same but instead of using bool(r) for 1 I used (r-r)**(r-r): f = lambda r: (r==r-r or r==(r-r)**(r-r))*(r-r)**(r-r) or r*blam(r-(r-r)**(r-r))

• Cracked. Commented Aug 6, 2017 at 10:32

Cubically, A016742 (Cracked)

This sequence is even square numbers: 0, 4, 16, 36, 64, ...

Byte set:

• Any letter except [UuDdLlRrFfBb]
• The digits [6789]
• Any symbol except [-^:@/]
• Anything not mentioned in the ASCII character set, including whitespace.

Try It Online!

• You don't need to include that last note; languages (and language versions) made after the challenge are perfectly valid as of a new consensus. Commented Aug 2, 2017 at 2:09
• @MDXF I wanted to specify which version to use. It was created before loops, but after input. Future language changes may warrant changes to the answer. Commented Aug 2, 2017 at 3:32
• I suggest not changing the answer after this has already been posted. People may be working on a crack. Commented Aug 2, 2017 at 3:48
• @MDXF I know, I won't. I was just saying why I specified the version. I guess if anyone wants to crack it with future language versions, they're welcome to. Commented Aug 2, 2017 at 4:04
• Cracked Commented Aug 7, 2017 at 13:31

Braingolf, A010701 Score: 9 [SAFE]

Byte set:

0x21, 0x24, 0x2F, 0x3A, 0x3F, 0x5B, 0x5D, 0x5F, 0x7C

Try it Online!

The code:

$_ Remove top of stack / Niladic division, push 5 [...] While loop, decrements bottom of stack at start of loop then decrements each time loop reaches end Exits when bottom of stack is 0 !?:.| If conditional without popping, runs contained code if top of stack is 0 This is the sneaky trick here. The conditional skips the end of the loop As a result, this whole block from [ to | effectively acts as a decrement. [!?:]| We do this twice to lower the 5 we pushed down to 3 Implicit output of top of stack. • So, I was wondering why nobody had solved this yet, and I realised it relies on an undocumented feature of while loops. Whoops! Try experimenting around a little with while loops and conditionals, and you should find the answer fairly easily ;) Commented Jul 30, 2017 at 14:58 • This is now safe. Commented Aug 6, 2017 at 14:02 Python 3, A000002, Cracked with the intended solution These are the bytes of a full program, 0-indexed solution for the Kolakoski sequence: OEIS A000002. pg*rn:e+%2a tu] (=foi[)1l, This contains a space, a newline, and all the other characters in the snippet above. Hopefully this won't be too easy to crack :) • Cracked! Commented Jul 27, 2017 at 18:14 Python 2, A000042, 11 Bytes (Cracked) Byte set: int(pru*1)' Answer: print '1'*input() Note: This is my first ever answer on PPCG, and I may have made a mistake... • Cracked? This doesn't work for the 0 term, but it seems that this was the intended program. Commented Jul 27, 2017 at 18:37 • @notjagan also what I just got - Bobawob, does yours work for 0? Commented Jul 27, 2017 at 18:37 • Could it be 1 indexed instead? – JAD Commented Jul 27, 2017 at 18:38 • Yes, it was the intended program. Sorry, did I need to include the 0th term? Like I said, this is my first ever challenge. Commented Jul 27, 2017 at 18:39 • @Bobawob just switch it to this sequence, which is the same just without a leading 0 Commented Jul 27, 2017 at 19:19 JavaScript (ES6), 4 bytes, A005408 (Cracked) This should be an easy one. Odd numbers: a(n) = 2n+1 Byte set:$+=>
• Cracked! (I hope, it's my first Cops & Robbers answer) Commented Jul 27, 2017 at 22:02

Python 2, A001146, Cracked

Byte set:

print(2*u)
• Cracked
– lynn
Commented Jul 28, 2017 at 13:11

LOLCODE, A000290, Cracked

Byte set:

.12ABDEFGHIKLMNOPRSTUVXY

The byte set also includes space and newline.

HAS FUNZ!

• Are we allowed newlines? As far as the interpreter I'm using (your link), they are required to not get errors. Commented Jul 28, 2017 at 15:12
• Yes, there are newlines... Sorry! Commented Jul 28, 2017 at 15:16
• Also 1.2 (or other HAI version) would be needed to run Commented Jul 28, 2017 at 15:18
• Cracked Commented Jul 28, 2017 at 15:28

CJam, A000142, 8 bytes, Cracked

Byteset: {}*+)%1\

• Cracked Commented Jul 28, 2017 at 13:19

Unreadable, A000027, 92 bytes, Cracked

Byte Set:

!"#%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_abcdefghijklmnopqrstuvwxyz{|}~

Also add space and newline

• Why not include all of the bytes for maximum score? There is no loss to adding more bytes if they can't be used. Commented Jul 28, 2017 at 13:52
• There are no other bytes in unreadable that I used. I don't even think that there are other bytes in the language... Could I add all of ASCII even if my language doesn't use some of the characters? Commented Jul 28, 2017 at 13:55
• Since Unreadable is encoded in ASCII you can and probably should use all the characters in ASCII. Commented Jul 28, 2017 at 14:21
• Cracked Commented Jul 28, 2017 at 14:51
• It's not cracked yet! You are forgetting that the first value in A000027 in 1, not 0. Commented Jul 28, 2017 at 14:52

Octave, A000045

This produces the Fibonacci numbers, OEIS A000045. There's both a space and a newline in there.

It's 0-indexed, so input 0 gives 0.

()-;=>cdefinotu
• Commented Jul 28, 2017 at 22:59

JavaScript, A000004 (Cracked)

Look from the other side

at~N+1

Step Hen's solution

~NaN+1

My solution #1

~1+1+1

#2

~~NaN

• Cracked (at least for Chrome console) Commented Jul 29, 2017 at 2:19

Python 2, A006577, Cracked

Byte set:

+s-t,n u
r)i1(d>]f[:e&

Shouldn't be too hard, but still fun.

EDIT: Cracked by @BruceForte. The crack looks just about identical to my crack, but here's mine for reference.

Try it Online

• Did you mean to include a p, or was that intentionally left out? Commented Jul 28, 2017 at 6:36
• @Azulflame p isn't needed since it seems that printing is not required as long as the value is somehow returned. See here for a non-contested, and valid, crack. Commented Jul 28, 2017 at 11:25
• Commented Jul 29, 2017 at 1:17

dc, A028444(cracked)

-?/*+23568dpr

There are no spaces in the byte set, but that’s not a big deal for dc.

Sequence is indexed at 0.

Note: Rado’s Sigma function grows faster than any computable function and is thus noncomputable!

Intended solution: ?dddddd***3*rdd**22*-rd*53*+r26*-8/p

• Commented Jul 29, 2017 at 15:08

!$+-012<=>JS[]lnprsu Well. Let's see how this plays out. • I wanted to continue working on it, but you added a -, therefore: cracked. Nice way to promote your language! Commented Jul 29, 2017 at 21:21 Perl 5, A007094 (Cracked) Numbers in base 8 Byte set sub {if($_[1]!=%/)ret-n;}

Try it online!

• Two r in your byteset Commented Jul 28, 2017 at 19:00
• I like how your byteset as-is looks like valid Perl. Commented Jul 28, 2017 at 20:07
• Commented Jul 30, 2017 at 18:05

shortC, A000240, 64 bytes

Uses the characters in this ASCII map:

"     %     ( ) * + , -
1 2                       >
@ A         F     I
R   T             [   ]
a     d         i         n o
p       t     w       {   }

Map credit: ETHproductions

• By far the most random place I've ever found myself given credit for something :P Commented Aug 4, 2017 at 0:50

CPython 3.6.2, A000796 (cracked)

I like Latin-1. Here's another 70 characters.

,Ðûô[u÷ÎÆ»énb¤Äö]?có´å¡ùÇõÓ«;Ñ$èñÙdÁ¼ ¢üÔltsð½(þÚ#ä.×çÈýÅ§ã¯\)³íï¬Â±¥_Ê=iÌ This bunch of characters can calculate the decimal digits of pi. Surely this requires flow control. And yet there isn't a colon, so that is impossible. You can't even eval a string when there is neither eval nor a string. I'll give a hint: my program takes input from stdin and outputs to stdout, but I am almost completely certain that it is possible to use other I/O methods. • For anyone wondering, the available ASCII chars are #$(),.;=?[\]_bcdilnstu and newline, and the non-ASCII ones are ¡¢¤¥§«¬¯±³´»¼½ÁÂÄÅÆÇÈÊÌÎÐÑÓÔ×ÙÚãäåçèéíïðñóôõö÷ùûüýþ. Commented Jul 31, 2017 at 14:22
• @ETHproductions Now you've spoiled it! :-) At least it makes my love of FreeBSD clear. Commented Jul 31, 2017 at 14:32
• It's really not hard to sort the charset... :P Now I'm thinking this must be a template of some sort, since your other answer uses exactly the same ASCII set. I don't know zip about why you would be so specific about CPython 3.6.2 though, so I'll leave that to the Python experts... Commented Jul 31, 2017 at 14:35
• @ETHproductions It's because the subset I've chosen is Turing complete. It's because I'm not about to claim that it works in a version that I haven't tested it in, and I've been very hackish. Commented Jul 31, 2017 at 14:52
• Commented Aug 4, 2017 at 18:22

Fe_pz:"/`'-2;

Try it online!

Explanation:

":z--F_p-2

R, A000027 (Cracked)

An easy one to warm up :)

Byteset:

eiytnd

Solution:

identity returns the input, so maps n to n.

• Cracked? Commented Jul 27, 2017 at 17:36
• @Shaggy Wouldn't that just return the integer? Shouldn't it return a whole sequence? Or maybe Jarko misunderstood? Commented Jul 27, 2017 at 17:37
• @MrXcoder: Or maybe I did! :D Commented Jul 27, 2017 at 17:39
• It should return the nth entry, so this works.
Commented Jul 27, 2017 at 17:44

Python 2, 24 bytes, A001246, cracked

Byte set:

)(+*-/12:=<acbdfmlonrx

Try it online!

• Cracked Commented Jul 27, 2017 at 18:31
• Agh, no fair. :P Commented Jul 27, 2017 at 18:31

Python 2, 21 bytes, A157433, cracked

6ut1 28rp5=)ni+03(*7

Try it online!

Original solution:

n=input() print 128*n**2+2336*n+10657

Probably super easy, but eh, I have =).

• Commented Jul 27, 2017 at 18:59
• Well, I had already posted this, so double cracked. Commented Jul 27, 2017 at 19:04

Jelly, 16 bytes, A000042 (Cracked)

Byte Set:

%1@JOiv¤ØȷḌṁị“”€

(The two quotes are different: one is opening and the other is closing).

(uses Jelly codepage)

The sequence is: a(n) is the unary representation of n.

• This challenge requires you to submit a character set to use rather than a list of characters
– Blue
Commented Jul 27, 2017 at 19:07
• Commented Jul 27, 2017 at 19:13
• Well a character set rather than list makes this quite a bit easier. Commented Jul 27, 2017 at 19:16

Python 3, 19 byteset, A000290, Cracked

This is the perfect squares: 0, 1, 4, 9, ....

Byteset:

(fam, l+db-ise=10:)

Note: I had two iterations with duplicate characters (and missing characters) because I'm dumb.

My solution (not very efficient):

f=lambda l,a=1,b=0:f(l-1,a+1+1,b+a) if l else b

Try it online!

• Why are there two as in the byteset Commented Jul 27, 2017 at 20:52
• @ppperry my bad, sorry. Fixed. Commented Jul 27, 2017 at 21:02
• still two 1s. Commented Jul 27, 2017 at 21:12
• @ppperry I don't know why this was so hard - I believe it's fixed now, so sorry 0.o Commented Jul 27, 2017 at 21:17
• – lynn
Commented Jul 27, 2017 at 21:17