Stealing sequences: Cops

10

2

This is . 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.

vroomfondel

Posted 2017-06-23T16:54:18.243

Reputation: 2 094

Sandbox post: https://codegolf.meta.stackexchange.com/a/13042/66460

– vroomfondel – 2017-06-23T16:58:17.283

In 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

Answers

2

MarioLANG, 23 bytes cracked

   >+
 :<":
>+^!<
===#=

Try it online!

produces the odd numbers A005408

marcosm

Posted 2017-06-23T16:54:18.243

Reputation: 986

cracked – Leaky Nun – 2017-06-23T18:48:48.420

1

C, A000217, 239 bytes Cracked

This isn't so I didn't bother.

#include <stdio.h>
#include <limits.h>
int main()
{
    int i, n, temp = 0;
    for(i = 0; i < INT_MAX; i++)
    {
        n = 0;
        temp = i;
        while(temp)
            n+=temp--;
        printf("%d, ", n);
    }
    return 0;
}

Sequence: https://oeis.org/A000217

Govind Parmar

Posted 2017-06-23T16:54:18.243

Reputation: 828

1@rogaos The one that is cracked from this code is not constant (at least, the one I'm aware of) – Govind Parmar – 2017-06-23T18:17:04.890

Edited in bytes for robber's convenience. – Stephen – 2017-06-23T18:17:29.550

1cracked? – nmjcman101 – 2017-06-23T18:18:49.353

@rogaos I think this could be cracked better than mine by making it constant, but I think it's more interesting to be non-constant, so I'd vote for this to not be an exception to the constant rule – nmjcman101 – 2017-06-23T18:22:21.540

1@nmjcman101 fair enough, as Govind didn't intend it to be a constant. Deleting my comment above. – vroomfondel – 2017-06-23T18:23:36.100

1

Python 2, 273 bytes, cracked

Initial Sequence: A004442

import zlib, base64;exec(zlib.decompress(base64.b64decode('eJzLtDUAAAHoANc=')))
while True:print eval(zlib.decompress(base64.b64decode('eJwzAgAAMwAz')))^eval(zlib.decompress(base64.b64decode('eJwzjssEAAHBAPs='))),;exec(zlib.decompress(base64.b64decode('eJzL1LY1BAAC1AED')))

Try it online!

juniorRubyist

Posted 2017-06-23T16:54:18.243

Reputation: 875

cracked – nore – 2017-06-26T01:28:39.623

2mega cracked (I think) – Stephen – 2017-06-26T01:45:41.630

1

MOO, 86 bytes, safe

a=0;b=1;while(a>-1)a=$math_utils:sum(a,a);a=max(1,a);notify(player,tostr(a));endwhile

Prints powers of two (A000079).

Solution:

a=1;while(a>-1)a=$math_utils:sum(a,a,a);notify(player,tostr(a));endwhile (which prints powers of 3 (A000244) instead)

pppery

Posted 2017-06-23T16:54:18.243

Reputation: 3 987

0

PHP, 20 bytes Cracked

for(;;)echo+!$i,",";

Try it online!

print sequence https://oeis.org/A000012

Jörg Hülsermann

Posted 2017-06-23T16:54:18.243

Reputation: 13 026

Your original version cracks this version. – vroomfondel – 2017-06-23T17:33:34.277

Cracked – Peter Taylor – 2017-06-23T17:35:04.420

Did you have a solution in mind for the first one? If so, you should roll back. – vroomfondel – 2017-06-23T17:35:24.960

1@rogaos, I cracked the current version without seeing that it had changed. Rolling back would cause a mess. – Peter Taylor – 2017-06-23T17:36:38.180

I commented to ask for the rollback before I saw your solution. Leaving it as-is is fine. – vroomfondel – 2017-06-23T17:37:41.060

@rogaos I have make this example to show that many approachs can be solve by a similar sequence. Give me one digit and I can use one of them – Jörg Hülsermann – 2017-06-23T17:39:34.370

@PeterTaylor It is okay that it be cracked – Jörg Hülsermann – 2017-06-23T17:40:07.870

@JörgHülsermann I've edited the scoring mechanism such that you lose 1/2 point for each cracked submission, to dissuade trivial answers like this one. It only applies to answers after this one (so your score is still 0.) – vroomfondel – 2017-06-23T17:45:06.300

1@rogaos You should ban sequences which return a constant value – Jörg Hülsermann – 2017-06-23T17:53:16.403

0

cQuents (older commit), 10 bytes, cracked

=0,1,1:z+y

This is still a heavily WIP language, but I patched the interpreter up so it worked. Click the language name for the Github link.

This outputs the Fibonnacci sequence: A000045

Explanation:

(because I have no documentation and I don't expect you to read my interpreter code)

=0,1,1      Set start to [0,1,1]
      :     Mode: sequence
       z+y  Each term is the previous two terms added together
            Because there is no input, output the whole sequence

If constant sequences were still allowed, this would be super easy to rob.

Stephen

Posted 2017-06-23T16:54:18.243

Reputation: 12 293

cracked – Leaky Nun – 2017-06-23T19:19:26.497

This language is excellent – vroomfondel – 2017-06-23T23:39:47.563

@rogaos it's not done yet, nowhere close, but thanks :) – Stephen – 2017-06-24T00:00:29.297