10
\$\begingroup\$

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.

\$\endgroup\$
11
  • \$\begingroup\$ Sandbox post: codegolf.meta.stackexchange.com/a/13042/66460 \$\endgroup\$ Commented Jun 23, 2017 at 16:58
  • 1
    \$\begingroup\$ This challenge is extremely similar. I won't dupe hammer it, but I think this is probably a duplicate. \$\endgroup\$ Commented Jun 23, 2017 at 17:56
  • 1
    \$\begingroup\$ @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. \$\endgroup\$ Commented Jun 23, 2017 at 17:57
  • 1
    \$\begingroup\$ Thanks, @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. \$\endgroup\$
    – Shaggy
    Commented Jun 23, 2017 at 23:23
  • 3
    \$\begingroup\$ I think that golfing vs Levenstein distance makes this substantially different. Cops have to consider drastically different potential solutions. \$\endgroup\$ Commented Jun 24, 2017 at 0:02

6 Answers 6

2
\$\begingroup\$

MarioLANG, 23 bytes cracked

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

Try it online!

produces the odd numbers A005408

\$\endgroup\$
1
  • \$\begingroup\$ cracked \$\endgroup\$
    – Leaky Nun
    Commented Jun 23, 2017 at 18:48
1
\$\begingroup\$

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

\$\endgroup\$
5
  • 1
    \$\begingroup\$ @rogaos The one that is cracked from this code is not constant (at least, the one I'm aware of) \$\endgroup\$ Commented Jun 23, 2017 at 18:17
  • \$\begingroup\$ Edited in bytes for robber's convenience. \$\endgroup\$
    – Stephen
    Commented Jun 23, 2017 at 18:17
  • 1
    \$\begingroup\$ cracked? \$\endgroup\$
    – nmjcman101
    Commented Jun 23, 2017 at 18:18
  • \$\begingroup\$ @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 \$\endgroup\$
    – nmjcman101
    Commented Jun 23, 2017 at 18:22
  • 1
    \$\begingroup\$ @nmjcman101 fair enough, as Govind didn't intend it to be a constant. Deleting my comment above. \$\endgroup\$ Commented Jun 23, 2017 at 18:23
1
\$\begingroup\$

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!

\$\endgroup\$
2
  • \$\begingroup\$ cracked \$\endgroup\$
    – nore
    Commented Jun 26, 2017 at 1:28
  • 2
    \$\begingroup\$ mega cracked (I think) \$\endgroup\$
    – Stephen
    Commented Jun 26, 2017 at 1:45
1
\$\begingroup\$

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)

\$\endgroup\$
0
\$\begingroup\$

PHP, 20 bytes Cracked

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

Try it online!

print sequence https://oeis.org/A000012

\$\endgroup\$
9
  • \$\begingroup\$ Your original version cracks this version. \$\endgroup\$ Commented Jun 23, 2017 at 17:33
  • \$\begingroup\$ Cracked \$\endgroup\$ Commented Jun 23, 2017 at 17:35
  • \$\begingroup\$ Did you have a solution in mind for the first one? If so, you should roll back. \$\endgroup\$ Commented Jun 23, 2017 at 17:35
  • 1
    \$\begingroup\$ @rogaos, I cracked the current version without seeing that it had changed. Rolling back would cause a mess. \$\endgroup\$ Commented Jun 23, 2017 at 17:36
  • 1
    \$\begingroup\$ @rogaos You should ban sequences which return a constant value \$\endgroup\$ Commented Jun 23, 2017 at 17:53
0
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\begingroup\$ cracked \$\endgroup\$
    – Leaky Nun
    Commented Jun 23, 2017 at 19:19
  • \$\begingroup\$ This language is excellent \$\endgroup\$ Commented Jun 23, 2017 at 23:39
  • \$\begingroup\$ @rogaos it's not done yet, nowhere close, but thanks :) \$\endgroup\$
    – Stephen
    Commented Jun 24, 2017 at 0:00

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.