10
2
This is cops-and-robbers. This is the Cops thread. For the robbers thread, go here.
I've noticed a number of OEIS (On-line Encyclopedia of Integer Sequences) challenges since I joined the site. It seems only fair that we have a cops-and-robbers challenge that determines who is the master of online integer sequences, once and for all.
Edit: In order to prevent trivial answers, cops lose 1/2 point for each submission that is cracked. Additionally, for the purposes of this challenge, constant sequences are not allowed. This only applies to solutions posted after this edit.
Cops
Write a program or function that, given no input, deterministically prints any sequence from the OEIS. By deleting some subset of the characters, your program must be able to print a different OEIS sequence when run in the same language. The new sequence must be entirely new, not just the first by a different name or with a different offset. Neither sequence may be simply a repeated constant value.
You must provide the first function, along with the name of the OEIS sequence so correctness can be verified. It's OK if behavior gets questionable around your language's MAX_INT value or 256, whichever is larger.
Robbers
Delete characters from some Cop's submission such that your new program outputs any other sequence from the OEIS. Provide the new function along with the name of the new OEIS sequence. Here is a utility to make sure that your submission is valid (i.e. deletes characters without any funny business. Doesn't check the sequence itself.)
It's in your best interest to delete as many characters from the Cop's submission as possible. If another robber (anyone except the Cop who authored the original program) comes along and finds a shorter solution that finds another different sequence, that robber steals your point. (Note that simply golfing off characters and printing the same sequence is not sufficient to steal the point.)
Rules & Scoring
If, after one week, nobody has been able to crack your solution, you can mark your solution as safe by providing the second program along with the name of the sequence it generates.
You get one point for each safe posting and one point for each submission you crack. Cops lose 1/2 point for each cracked submission. Note that another robber can steal your point from the cracked submission at any time by providing a shorter program that yields a different sequence.
Cops may only post one challenge per language, per person.
The player with the most points at 12:00 UTC on 7 July wins.
Sandbox post: https://codegolf.meta.stackexchange.com/a/13042/66460
– vroomfondel – 2017-06-23T16:58:17.283In order for a solution to be solved, does the robber need to delete the correct characters? For example, what if they manage to find a solution but it wasn't the intended one, and produces a third sequence that the cop did not intend the program to ever produce? – scatter – 2017-06-23T17:06:59.013
@Christian that is a perfectly valid solution (see how robbers can steal from one another.) The cop needs to provide a program for which this is possible but also needs to protect from other sequences. – vroomfondel – 2017-06-23T17:08:08.287
Sorry, this is too easy for the cops and robbers. – juniorRubyist – 2017-06-23T17:28:52.540
@juniorRubyist it can't be too easy for both the cops and robbers. It may be easier for the robbers, but there are a few things cops can do to make it more challenging. – vroomfondel – 2017-06-23T17:30:15.873
1This challenge is extremely similar. I won't dupe hammer it, but I think this is probably a duplicate. – FryAmTheEggman – 2017-06-23T17:56:09.180
1@FryAmTheEggman ah, didn't see that. I don't think it's quite a dupe as hamming distance =/ deletions and the robbers have a lot more leeway to find unintended answers, but it is more similar than I would like. – vroomfondel – 2017-06-23T17:57:47.603
Two questions, and the first might speak to my ignorance of C&R: 1) if I post a Cops solution that ends up being "safe", am I allowed to post the exact same solution again to try for another point? 2) When you say the Robbers have to remove a subset of characters, do you mean the characters removed must be sequential? – Shaggy – 2017-06-23T22:53:05.003
@Shaggy to your first question, you can't post two solutions in the same language, so I'd say the answer is no. To the second question, they do not have to be sequential, but you can't reorder characters. – vroomfondel – 2017-06-23T22:55:08.900
1Thanks, @rogaos. That was the answer I expected to the first question so no worries. Got a couple of ideas for Cops, hopefully I'll get a few minutes in the morning to work them up. – Shaggy – 2017-06-23T23:23:07.190
3I think that golfing vs Levenstein distance makes this substantially different. Cops have to consider drastically different potential solutions. – Nathan Merrill – 2017-06-24T00:02:28.953