5
\$\begingroup\$

This is . This is the Robbers thread. For the cops thread, go here.

I've noticed a number of OEIS 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.

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. Your new sequence may not simply be a repeated constant value.

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

The player with the most points at 12:00 UTC on 7 July wins.

\$\endgroup\$
  • \$\begingroup\$ Be warned that languages exist where MAX_INT is 1. You should probably require at least 256. \$\endgroup\$ – CalculatorFeline Jun 23 '17 at 16:59
  • \$\begingroup\$ Here is a utility to check whether a robber's submission is legal (i.e. only deletes characters from a cop's): tio.run/… \$\endgroup\$ – vroomfondel Jun 23 '17 at 19:22
5
\$\begingroup\$

C (gcc), Govind Parmar 142 bytes deleted

Golfed more thanks to @StephenS. I'm not sure it matters, but just for the spirit of the site!

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

Try it online!

Sequence: A001477

\$\endgroup\$
  • 1
    \$\begingroup\$ I swear you had posted something different the first time I looked. Anyway, here is it golfed down more: try it online \$\endgroup\$ – Stephen Jun 23 '17 at 18:26
2
\$\begingroup\$

PHP, Jörg Hülsermann, 1 byte deleted

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

Produces A000004

\$\endgroup\$
2
\$\begingroup\$

MarioLANG, marcosm, 13 bytes deleted

>+:<
===#=

Try it online!

A109613.

\$\endgroup\$
  • \$\begingroup\$ how do you get the +: part only by deleting? \$\endgroup\$ – marcosm Jun 23 '17 at 19:02
  • \$\begingroup\$ @marcosm The + is from the first line, and the : from the second line. \$\endgroup\$ – Leaky Nun Jun 23 '17 at 19:03
  • \$\begingroup\$ great! understood now \$\endgroup\$ – marcosm Jun 23 '17 at 19:06
2
\$\begingroup\$

cQuents, Stephen S, 1 byte deleted

=0,11:z+y

A022345.

\$\endgroup\$
1
\$\begingroup\$

PHP, Jörg Hülsermann, 5 bytes deleted, Non-Competing

for(;;)echo+$i;

Produces A000004

\$\endgroup\$
  • \$\begingroup\$ Peter Taylor currently holds the point, since your solution provides the same sequence. \$\endgroup\$ – vroomfondel Jun 23 '17 at 17:48
  • \$\begingroup\$ Dang it. I missed that point. \$\endgroup\$ – juniorRubyist Jun 23 '17 at 17:53
  • \$\begingroup\$ Still, it's a good example of how easy it is to overlook significant savings, so +1 from me. \$\endgroup\$ – Peter Taylor Jun 23 '17 at 18:05
1
\$\begingroup\$

Python 2, juniorRubyist, 253 bytes deleted

while True:print 6,4

Try it online!

Not sure how valid this is, because of the newlines, but I believe whitespace is irrelevant. TIL that if I could add a comma at the end, it would fix the whitespace.

A226294

\$\endgroup\$
  • \$\begingroup\$ Isn't this a constant sequence? \$\endgroup\$ – juniorRubyist Jun 26 '17 at 2:05
  • \$\begingroup\$ @juniorRubyist as far as I can tell, OP currently only bans constant sequences that only output the same value - the exact words are Neither sequence may be simply a repeated constant value.. a seems to me to mean one. If OP actually means an alternating pattern I'll delete my answer. \$\endgroup\$ – Stephen Jun 26 '17 at 2:15
  • \$\begingroup\$ @StephenS while non-periodic sequences are somehow more "interesting" I can't ban periodic sequences since I'm sure there are plenty of sequences in oeis whose periodicity is unknown. So this is a legal answer. The whitespace is fine. \$\endgroup\$ – vroomfondel Jun 26 '17 at 12:21
0
\$\begingroup\$

Python 2, juniorRubyist, 114 bytes deleted cracked

import zlib, base64;exec(zlib.decompress(base64.b64decode('eJzLtDUAAAHoANc=')))
while True:print i,;exec(zlib.decompress(base64.b64decode('eJzL1LY1BAAC1AED')))

Try it online!

A001477.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.