# Stealing sequences: Cops

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.

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

# MarioLANG, 23 bytes cracked

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

Try it online!

produces the odd numbers A005408

# 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

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

# 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!

• cracked – nore Jun 26 '17 at 1:28
• mega cracked (I think) – Stephen Jun 26 '17 at 1:45

# 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)

# PHP, 20 bytes Cracked

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

Try it online!

print sequence https://oeis.org/A000012

• Your original version cracks this version. – vroomfondel Jun 23 '17 at 17:33
• Cracked – Peter Taylor Jun 23 '17 at 17:35
• Did you have a solution in mind for the first one? If so, you should roll back. – vroomfondel Jun 23 '17 at 17:35
• @rogaos, I cracked the current version without seeing that it had changed. Rolling back would cause a mess. – Peter Taylor Jun 23 '17 at 17:36
• @rogaos You should ban sequences which return a constant value – Jörg Hülsermann Jun 23 '17 at 17:53

# 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.

• cracked – Leaky Nun Jun 23 '17 at 19:19
• This language is excellent – vroomfondel Jun 23 '17 at 23:39
• @rogaos it's not done yet, nowhere close, but thanks :) – Stephen Jun 24 '17 at 0:00