12
\$\begingroup\$

This is a challenge, the cops thread can be found here.

This is the robbers thread, your job here is to take submissions on the cops thread and try to find the hidden sequences. If you find any sequence that can be substituted into the original code to compute that sequence that is a valid crack. Please notify the cops of your cracks as they happen so they can update their answers.

Scoring

Your score will be the number of successful cracks you have made, with more cracks being better.

\$\endgroup\$
2
  • \$\begingroup\$ Why not just let robbers comment the sequence # in the cops thread? \$\endgroup\$
    – lynn
    Commented Aug 3, 2017 at 16:08
  • 5
    \$\begingroup\$ @Lynn I think that robbers should be able to get upvotes for their work in cracking answers. I prefer the two thread format for that reason. \$\endgroup\$
    – Wheat Wizard
    Commented Aug 3, 2017 at 16:09

13 Answers 13

5
\$\begingroup\$

Japt, Shaggy, A000290

p#A000290uCnG

Try it online!

\$\endgroup\$
4
\$\begingroup\$

Python 3: Mr. Xcoder, A010709

n=int(input())
print(sum(1for i in"A010709"if i>"0")*-~n//-~n)

Try it online!

Additionally, here's a golfed version of the original. :P

lambda n:sum(1for i in"A017016"if i>"0")*-~n//-~n
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Well done... I knew it would be cracked soon \$\endgroup\$
    – Mr. Xcoder
    Commented Aug 3, 2017 at 15:14
4
\$\begingroup\$

Python 3, pppery

A018226

The original code put the sequence name in a comment. Since the comment probably can't affect the code I figured the hidden sequence had to be some sub-sequence of the original. A quick search of the first couple terms brought up A018226. Since it is a sub-sequence the code works for both. A018226 is even listed on the original sequence's page if you look back

One way to generalize the magic number sequence in A018226.

\$\endgroup\$
3
  • \$\begingroup\$ That was the intended solution. I had the idea of trying to make people think it was impossible by putting the sequence in a comment. \$\endgroup\$ Commented Aug 3, 2017 at 18:17
  • \$\begingroup\$ @ppperry The comment was what gave it away :). I figured it had to be a sub-sequence. Good fun anyway! \$\endgroup\$
    – Wheat Wizard
    Commented Aug 3, 2017 at 18:18
  • \$\begingroup\$ Maybe I could have hid that better, but still is an interesting twist compared to the typical answers to this sort of thing; about numbers, rather than code. \$\endgroup\$ Commented Aug 3, 2017 at 18:20
3
\$\begingroup\$

C#, TheLethalCoder

A000578 (Cubes)

An easy one - it was also posted here.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Of course, people should stop posting the answers from the other challenge :) \$\endgroup\$
    – Mr. Xcoder
    Commented Aug 3, 2017 at 14:50
3
\$\begingroup\$

Python 2, Dead Possum

A000007: The characteristic function of 0: a(n) = 0^n.

\$\endgroup\$
3
\$\begingroup\$

C#, TheLethalCoder, A000244

Also works with A000079 (powers of two).

\$\endgroup\$
3
\$\begingroup\$

Python 2, Dead Possum

A000244 (Powers of 3)


This no longer works, the OP updated the example after I posted this.

\$\endgroup\$
3
\$\begingroup\$

dc, Bruce Forte

Cracked with A027480.

\$\endgroup\$
3
  • \$\begingroup\$ Well done! What gave it away? \$\endgroup\$ Commented Aug 4, 2017 at 13:42
  • 2
    \$\begingroup\$ The modulus operations limit the number of sequences generated. In this case 8 × 9 = 72. So plugged the formula into a spreadsheet and generated all of them. Only a handful of sequences produced all integers for all terms, and of those made a guess that only sequences with all positive terms would be of interest. Then it was a matter of searching the sequences and plugging the reference number back in. Searched five, three had corresponding entries, the third one matched outputs for all inputs. \$\endgroup\$
    – user15259
    Commented Aug 4, 2017 at 14:01
  • \$\begingroup\$ If only I had not divided by 2 ;P \$\endgroup\$ Commented Aug 4, 2017 at 14:13
2
\$\begingroup\$

Python 2: officialaimm, A055642

lambda x:len(`x**(sum(map(int,'A055642'[1:]))==22)`) 

Try it online!

It took me a while to find the sequence... Mostly 'cause OEIS search is super slow for me. o0

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Nicely done. (y) \$\endgroup\$
    – 0xffcourse
    Commented Aug 3, 2017 at 17:29
2
\$\begingroup\$

Python 3, ppperry, A000027 -> A004526

f=lambda a,n=((int("A004526",11)-0x103519a)%100%30+1)/2:a//(14-n)

Try it online! (prints first few terms of both. Note the two sequences have offsets of 1 and 0 respectively, so the first has a leading zero - it threw me a little!)

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

MATL, Cinaski

Cracked with A055642.

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

Python 3.6, RootTwo

Original is A005843
Cracked with A001107

Try it online

The eval'd code of the original (minus comments) is n*2, of the cracked version is 4*n*n-n*3.

After filtering out syntax errors, undeclared variables, zero divisions, etc, it didn't take too long to run through the remaining list. There were a few false positives (like A004917) that I had to filter out by hand due to only checking the first few numbers, but it wasn't too common.

Also, A040489 tries to calculate n**3436485154-n, which slowed me down a bit. :P

\$\endgroup\$
2
  • \$\begingroup\$ Congrats. That's it. Did you brute force it? I tried to make a few incorrect sequence ID's result in valid Python to slow things down, but not enough I guess. \$\endgroup\$
    – RootTwo
    Commented Aug 10, 2017 at 3:38
  • \$\begingroup\$ @RootTwo I did mostly brute force it. I had some other heuristics in there too, but nothing very complex. Took a couple mins to find 1107, about 8 to get up to 5843. Out of curiousity, I went up to 50000. No other matches in that range. I'd guess 15-20% were valid python. \$\endgroup\$
    – Phlarx
    Commented Aug 10, 2017 at 4:04
1
\$\begingroup\$

Chip, Phlarx

Cracked with A060843. On a hunch, guessed the sequence was going to be short!

\$\endgroup\$
1
  • \$\begingroup\$ You got it! Good job \$\endgroup\$
    – Phlarx
    Commented Aug 10, 2017 at 4:06

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.