Solving Secret Swapping Sequences

12

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.

Post Rock Garf Hunter

Posted 2017-08-03T14:47:02.100

Reputation: 55 382

Why not just let robbers comment the sequence # in the cops thread? – Lynn – 2017-08-03T16:08:27.907

5@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. – Post Rock Garf Hunter – 2017-08-03T16:09:30.960

Answers

5

officialaimm

Posted 2017-08-03T14:47:02.100

Reputation: 2 739

4

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

totallyhuman

Posted 2017-08-03T14:47:02.100

Reputation: 15 378

1Well done... I knew it would be cracked soon – Mr. Xcoder – 2017-08-03T15:14:54.247

4

Python 3, ppperry

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.

Post Rock Garf Hunter

Posted 2017-08-03T14:47:02.100

Reputation: 55 382

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. – pppery – 2017-08-03T18:17:57.910

@ppperry The comment was what gave it away :). I figured it had to be a sub-sequence. Good fun anyway! – Post Rock Garf Hunter – 2017-08-03T18:18:40.413

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. – pppery – 2017-08-03T18:20:05.040

3

C#, TheLethalCoder

A000578 (Cubes)

An easy one - it was also posted here.

Shaggy

Posted 2017-08-03T14:47:02.100

Reputation: 24 623

1Of course, people should stop posting the answers from the other challenge :) – Mr. Xcoder – 2017-08-03T14:50:05.760

3

Python 2, Dead Possum

A000244 (Powers of 3)


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

TheLethalCoder

Posted 2017-08-03T14:47:02.100

Reputation: 6 930

3

Python 2, Dead Possum

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

TheLethalCoder

Posted 2017-08-03T14:47:02.100

Reputation: 6 930

3

C#, TheLethalCoder, A000244

Also works with A000079 (powers of two).

Lynn

Posted 2017-08-03T14:47:02.100

Reputation: 55 648

3

dc, Bruce Forte

Cracked with A027480.

user15259

Posted 2017-08-03T14:47:02.100

Reputation:

Well done! What gave it away? – ბიმო – 2017-08-04T13:42:03.147

2The 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. – None – 2017-08-04T14:01:15.930

If only I had not divided by 2 ;P – ბიმო – 2017-08-04T14:13:14.370

2

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

totallyhuman

Posted 2017-08-03T14:47:02.100

Reputation: 15 378

1Nicely done. (y) – officialaimm – 2017-08-03T17:29:26.417

2

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

Jonathan Allan

Posted 2017-08-03T14:47:02.100

Reputation: 67 804

2

MATL, Cinaski

Cracked with A055642.

user15259

Posted 2017-08-03T14:47:02.100

Reputation:

2

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

Phlarx

Posted 2017-08-03T14:47:02.100

Reputation: 1 366

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. – RootTwo – 2017-08-10T03:38:30.110

@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. – Phlarx – 2017-08-10T04:04:43.327

1

Chip, Phlarx

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

user15259

Posted 2017-08-03T14:47:02.100

Reputation:

You got it! Good job – Phlarx – 2017-08-10T04:06:51.590