Seeking Secret Swapping Sequences

19

0

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

Your task is to write some code that outputs an OEIS sequence, and contains the name of the sequence in the code (A______) and outputs a second separate sequence when the name of the sequence in the code is changed to the name of the second sequence.

Here's an example in Haskell that works for A000217 and A000290.

f x|last"A000217"=='0'=x^2|1>0=sum[1..x]

Try it online!

You are then to reveal one of the two sequences, and the code keeping the second sequence a secret. Robbers will attempt to figure out what the hidden sequence is. If a robber manages to determine what your sequence is (or another sequence that fits the criteria) you answer is cracked. If none do so in a week of your answer being posted you may mark your answer as Safe and reveal the intended solution for verification. Safe answers cannot be cracked.

Input Output

Taken from here

Your code can be a function or complete program that takes n via a standard input method and outputs the nth term of the sequence as indexed by the provided index on the OEIS page.

You must support all values provided in the OEIS b files for that sequence, any number not in the b files need not be supported.

Scoring

Your score will be the number of bytes in your code, with less bytes being better.

Post Rock Garf Hunter

Posted 2017-08-03T14:42:00.200

Reputation: 55 382

1Your score will be the number of bytes in your code, with less bytes being better. - Why isn't this tagged [tag:code-golf], then? – Mr. Xcoder – 2017-08-03T14:44:57.753

@Mr.Xcoder I forgot to. Don't read into these things too much ;) – Post Rock Garf Hunter – 2017-08-03T14:46:04.327

So code should output sequence of some length (defined or not?) or n-th element of sequence? – Dead Possum – 2017-08-03T14:55:00.453

@DeadPossum *nth term*. – Mr. Xcoder – 2017-08-03T14:56:02.093

@WheatWizard guess I was looking somewhere else, but monitor. My bad – Dead Possum – 2017-08-03T14:57:36.503

May we choose constant sequences (We should be allowed, IMHO)? – Mr. Xcoder – 2017-08-03T14:59:36.757

@Mr.Xcoder yes constant sequences are fine, (probably rather easy to crack though). Did something give you the impression they were disallowed? – Post Rock Garf Hunter – 2017-08-03T15:00:31.230

@WheatWizard Did something give you the impression they were disallowed? - No, of course not. – Mr. Xcoder – 2017-08-03T15:01:49.703

Can we amend leading zeroes in sequence number? Like A1 – Dead Possum – 2017-08-03T15:10:06.487

@DeadPossum No you cannot. – Post Rock Garf Hunter – 2017-08-03T15:10:28.257

Were any marked as the answer? Hint, mine was safe and had the lower byte count ;)

– None – 2018-07-08T12:38:46.777

@YiminRong No answers were marked. I don't mark answers. – Post Rock Garf Hunter – 2018-07-08T14:09:10.813

Answers

8

Python 3, 59 bytes, A162626, cracked by Wheat Wizard

lambda n:n*(n+1)*(n+2)/3if 0<=n<=3else n*(n**2+5)/3#A162626

This is was supposed to be impossible, wasn't it?

pppery

Posted 2017-08-03T14:42:00.200

Reputation: 3 987

2Cracked – Post Rock Garf Hunter – 2017-08-03T18:17:00.633

5

Python 3, 62 bytes, A017016 (Cracked)

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

Try it online!

Mr. Xcoder

Posted 2017-08-03T14:42:00.200

Reputation: 39 774

I tried to make it as obfuscated as possible... – Mr. Xcoder – 2017-08-03T15:09:30.743

1@officialaimm I did that on purpose. I want to make this obfuscated. I don't really care about golfing, because Python won't win a code-golf obfuscation contest :p – Mr. Xcoder – 2017-08-03T15:10:26.663

1Cracked? – totallyhuman – 2017-08-03T15:14:07.940

By the way, was that the intended solution? – totallyhuman – 2017-08-03T17:01:49.517

@totallyhuman Yeah, it was the indtended solution. – Mr. Xcoder – 2017-08-03T17:16:38.287

4

Japt, 13 bytes (Cracked)

There is (at least) one other solution, if anyone else wants to take a stab at it.

p#A000012uCnG

Try it online
A000012


Explanation

# followed by a character in Japt gives us the charcode of that character, so #A=65, which the rest of the number then gets appended to, giving us 65000012 or 65000290.

u is the modulo method (it differs from % in that it will always return a positive number).

The n method subtracts the number it is applied to from the number passed to it. C and G are the Japt constants for 11 & 15, respectively. So, CnG gives us 4.

We now have 65000012%4=0 and 65000290%4=2. The p method raises the number it's applied to (in this case that is, implicitly, the input integer U) to the power of the number passed to it, giving us the 2 final formulas of U**0 and U**2.

Shaggy

Posted 2017-08-03T14:42:00.200

Reputation: 24 623

cracked? – officialaimm – 2017-08-03T16:06:37.420

1@officialaimm: Correct, nicely done. – Shaggy – 2017-08-03T16:11:15.747

Since I don't know Japt, I had assumed the power to be raised was (sum_of_numbers_in_oeis(excluding 'A') + 1)%4. :D – officialaimm – 2017-08-03T16:44:19.867

1@officialaimm: I love seeing robbers crack challenges in languages they don't know :) I actually posted this with the hope that it would be someone unfamiliar with Japt who would crack it. – Shaggy – 2017-08-03T23:05:58.320

A020338 may also work if string input is allowed (1-indexed). – Bubbler – 2018-08-30T08:30:33.693

4

MATL, 30 29 bytes (Cracked)

A077430I\2-|Gw^1Mwx*10&Ylk1+&

A077430

Try it online!

-1 byte thanks to @Sanchises

Cinaski

Posted 2017-08-03T14:42:00.200

Reputation: 1 588

1Should be fixed now – Cinaski – 2017-08-04T06:57:10.747

1Just a hint: you can replace 3 by I for 1 byte. – Sanchises – 2017-08-04T08:11:11.247

@Sanchises Thanks! Didn't knew I is initialized to 3 – Cinaski – 2017-08-04T08:29:12.190

2You should check out Table 3. Along with l (one) and O (zero), you should almost never have to use a space in your MATL programs. On a related note, check out Table 7 as well, which contains many useful predefined constants (although beware that e.g. 4X2Z% has a shorthand 1Z%) – Sanchises – 2017-08-04T08:52:19.527

Cracked. – None – 2017-08-04T12:10:33.057

3

C#, 28 bytes (Cracked)

n=>n*n*("A000290"[6]<49?1:n)

Works with A000290.

An easy one to get this started.

Try it online!

TheLethalCoder

Posted 2017-08-03T14:42:00.200

Reputation: 6 930

It cannot be cracked yet >_< – Mr. Xcoder – 2017-08-03T14:47:16.213

@Mr.Xcoder Can now :) – TheLethalCoder – 2017-08-03T14:47:32.660

1Craked (although not really cracked!) – Shaggy – 2017-08-03T14:49:29.957

@Shaggy I just wanted to get the ball rolling :P – TheLethalCoder – 2017-08-03T14:50:08.483

3

C#, 75 bytes, (Cracked)

n=>{int r=1,e=3-0xA000244%2;for(;n>0;e*=e){r*=(n%2>0?e:1);n>>=1;}return r;}

A000244

Try it online!

TheLethalCoder

Posted 2017-08-03T14:42:00.200

Reputation: 6 930

Cracked – Lynn – 2017-08-03T16:11:09.470

@Lynn What gave it away? The first sequence? – TheLethalCoder – 2017-08-03T16:12:01.193

3You are taking the OEIS number % 2 — so the program can literally only do two things, depending on the outcome of that: one for 0 and one for 1. So I put an odd number in its place, and the challenge kinda cracked itself. – Lynn – 2017-08-03T16:15:04.813

@Lynn Ah suppose, didn't think obfuscating that part. – TheLethalCoder – 2017-08-03T16:16:15.047

3

Python 2, 43 bytes, A000079 (Cracked)

Try it online

lambda n:((sum(map(ord,'A000079'))*2)%8)**n

Dead Possum

Posted 2017-08-03T14:42:00.200

Reputation: 3 256

Cracked? – TheLethalCoder – 2017-08-03T15:22:36.100

@TheLethalCoder Well.. It fits, but it is not the one, that I've chosen. Also I made edit before your comment, and it no longer fits – Dead Possum – 2017-08-03T15:24:47.347

5You changed it after posting? A bit unfair. – TheLethalCoder – 2017-08-03T15:26:10.750

@TheLethalCoder I did it to protect from this false-positive sequence :C – Dead Possum – 2017-08-03T15:27:41.227

Cracked? – TheLethalCoder – 2017-08-03T15:37:39.780

@TheLethalCoder Yep! – Dead Possum – 2017-08-03T15:38:43.730

I knew it was powers of something I just had to find the right one. – TheLethalCoder – 2017-08-03T15:39:58.463

@TheLethalCoder **n is a good clue :D Sorry for confusion with powers of 3, I somehow missed it, while checking other powers of X to be false-positive – Dead Possum – 2017-08-03T15:41:52.383

1I don't know about editing an entry, but from the rules in the OP, "If a robber manages to determine what your sequence is (or another sequence that fits the criteria) you answer is cracked", just FYI. – alleks – 2017-08-03T23:49:27.013

2

Python 2, 53 bytes, A000012 [cracked]

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

Try it online!

The next sequence is A055642(length of digits in a decimal number). For which the number evaluates to itself, since sum of the digits in OEIS equals 22; the len(...) thus calculates to actual length of the input number for 'A055642'. For sequences A000012(or any other than A055642. The len will always equal to one, since the number evaluted will be '1'.

officialaimm

Posted 2017-08-03T14:42:00.200

Reputation: 2 739

1Cracked? – totallyhuman – 2017-08-03T17:25:53.887

1

Python 3, 65 bytes, A000027, cracked

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

Yay crazy arithmetic!

pppery

Posted 2017-08-03T14:42:00.200

Reputation: 3 987

Um, A004526, gives n=12 which looks right, but the result will be off by one index - did I crack with bug or fall for a very clever red herring?

– Jonathan Allan – 2017-08-03T22:31:55.590

Neither; you've misinterpreted A004526, which clearly states a(n) = floor(n/2); the sequence listed starts with 0. That is the intended solution, however. – pppery – 2017-08-03T22:44:46.657

Oh yes the offset - right (whew), thanks! Well cracked then.

– Jonathan Allan – 2017-08-03T23:54:32.643

1

Smalltalk, 148 bytes, safe!

|x o|x:=(16rA018253*0.00861-1445345)floor. o:=OrderedCollection new. 1 to:x/2 do:[:i|x\\i=0 ifTrue:[o add:i]].o add:x.^o at:stdin nextLine asInteger

A018253

Takes an integer as input, sequence is 1-based.

The intended second sequence is A133020. In the writeup for A018253 is a link to a list of entries for sequences related to the divisors of numbers. In that list, A133020 is under divisors of squares: 100². If you want to see the entire sequence, insert Transcript show: o printString; cr. before the return ^ statement in the code.

user15259

Posted 2017-08-03T14:42:00.200

Reputation:

1

Haskell, 226 bytes, safe!

Not sure if clever or ugly, maybe both...

o n=read.pure.(!!n)$"A001906"
m::Integral a=>[a->a->a]
m=[const,(+),(-),(*),div,(^)]++(flip<$>m)
l=o 1:o 3-o 1:zipWith(m!!(o 6+o 3-o 2))(tail l)l
f=(l!!).((m!!(o 4+o 5+o 6-2*o 1-o 2))$sum[1|n<-[1..6],odd(o n)]).((m!!o 6)$o 3)

So now this computes A001906, but it should be able to generate a lot of sequences.

Try it online!


Solution: A131078

Wondering if this was too difficult or no one tried?

o 1 to o 6 are the digits of the series number, m is a list of operations. l is a recursively defined infinite list with the first two values derived from the series number and the remaining ones computed from the previous two using a fixed operation from m. In the case of A001906, the definition can be simplified to

l=0:1:zipWith(flip(+))(tail l)l

(flip(+)) is (usually) the same as (+), and we get a well known (but not the shortest) definition of the Fibonacci numbers. This recursion scheme could directly compute A001906, but that needs an operation more complicated than those in m. Another example: using starting values 1 and 2 and the operation (*) gives the series A000301. It is computed by our code when the series number is replaced with ?103206.

Finally, the function f indexes into the list l, but only after some transformation of the input. For A001906, the middle part reduces to (*)2, so that we only get the Fibonacci numbers at even positions. The right part becomes flip const 1, which is the identity function and does not further interfere.

For the solution A131078, the starting values of l are 1 and 0, and the operation is flip const, which lets l be 1,0,1,0,.... The middle part of f becomes (flip div 4), resulting in 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,.... This looked like a nice answer, but then I saw that A131078 starts at n=1, so I added the right part of f, which here is flip(-)1 to subtract one.

My idea was to make it a bit obfuscated by using m and indexing into it with digits from the series numbers, then it became more obfuscated (complicated terms) to make it work (maybe I wasn't searching long enough for alternatives); and then it became even more obfuscated (right part of f) to make it really work. Still I think some guessing and trying could have cracked it.

Christian Sievers

Posted 2017-08-03T14:42:00.200

Reputation: 6 366

I tried a few sequences and they usually gave division by zero errors, negative exponent errors or just seemed to run forever. To be honest, Haskell freaks me out, just can't seem to wrap my head around it, spent too long in procedural I guess.

– None – 2017-08-18T01:06:32.467

If you're just trying, there is the extra problem that even the solution gives a "negative index" error when given 0. That is fine because it only starts at 1! Starting at 1 should also remove some of the "division by zero" errors. I'm surprised by examples running forever. Maybe the index transformation creates very big values in these cases... – Christian Sievers – 2017-08-18T09:36:31.630

0

dc, 52 bytes, cracked

This one works with A000217:

?SaA000217d8d1+Sb%1r-dScla*r10 7^-Lb%+la*1+Lc+La*2/p

Try it online!

ბიმო

Posted 2017-08-03T14:42:00.200

Reputation: 15 345

Cracked. – None – 2017-08-04T13:28:41.897

0

Chip, 67 bytes, cracked by Yimin Rong

2D5B#{*Cm49!}E-7
(A000012d#,zkmsh
b-\6/e2)[1Zv^~^S
33a#kcf3g88taz1@

A000012. A bit cheeky, yes.

Try it online!

Uses bytes for i/o, so I was nice and built a bashy/pythony wrapper.


Alternate sequence is A060843. Try it online for inputs 1..4.

Yimin Rong hunched right, such a short Chip program can only calculate very simple things. The original sequence is all one's, and the alternate sequence is the busy beaver numbers, of which only 4 are known.

These numbers, 1, 6, 21, 107, are simply hard-coded for the inputs 1..4.

One interesting thing about using Chip for this challenge is that the digits 0-9 are not numbers, but logical elements. Specifically, 0-7 are the eight bits addressing the head of the stack, and 8 and 9 are the read and write toggles. That made this a bit more interesting and much more obfuscated.

A potential giveaway is that only A-D appear, meaning that we only have 4 bits for indexing the sequence. This meant that there could be at most 16 different values. In fact, only A-C are actually used for the alternate sequence, giving at most 8 different values.

For any who might be interested, here is the same code, stripped of the no-ops and unused elements:

.

   B  *C 49!
 A000012d ,z  s
b-\6/e   1Zv-~^S
`3a`-cf3g`8taz1

Phlarx

Posted 2017-08-03T14:42:00.200

Reputation: 1 366

Just to exclude the obvious, you're not trying to sneak in an empty sequence, e.g. A290000? Technically, because your code returns nothing for input of zero, this sequence would match!

– None – 2017-08-07T11:21:51.357

Ha, there is at least one value in the other sequence :) Also, I should say, I designed this to be 1-indexed, since that's how OEIS is indexed. – Phlarx – 2017-08-08T14:14:37.073

(Nevermind, I found counterexamples. My code is still 1-indexed.) – Phlarx – 2017-08-08T14:23:05.287

So I did some more looking into it, and the doing-nothing is python's fault. It wasn't giving any output for zero, so my code never ran. I've fixed that in the TIO link now. (Gave the bit-length a floor of 1 byte). – Phlarx – 2017-08-08T15:14:46.133

1Cracked. – None – 2017-08-10T02:18:40.993

0

Python 3.6, 114 bytes, cracked

from random import*
g=lambda n:eval(''.join(Random("A005843").choices('n8-9+17n#8*+26%n1 32-3+4-545*-#6*7',k=34)))

A005843

g(n) returns the n-th value of the sequence for n >= 0.

random.choices(s,k) is new in Python 3.6, it returns k items selected from s with replacement.

RootTwo

Posted 2017-08-03T14:42:00.200

Reputation: 1 749

Feel very much like encryption/hashing. – pppery – 2017-08-09T02:09:58.623

@ppperry - if that's against the rules, I'll remove it. – RootTwo – 2017-08-09T07:20:22.843

Cracked? – Phlarx – 2017-08-09T18:56:43.573