# Seeking Secret Swapping Sequences

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.

• Your score will be the number of bytes in your code, with less bytes being better. - Why isn't this tagged code-golf, then? – Mr. Xcoder Aug 3 '17 at 14:44
• @Mr.Xcoder I forgot to. Don't read into these things too much ;) – Sriotchilism O'Zaic Aug 3 '17 at 14:46
• So code should output sequence of some length (defined or not?) or n-th element of sequence? – Dead Possum Aug 3 '17 at 14:55
• @DeadPossum nth term. – Mr. Xcoder Aug 3 '17 at 14:56
• @WheatWizard guess I was looking somewhere else, but monitor. My bad – Dead Possum Aug 3 '17 at 14:57

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

# Python 3, 62 bytes, A017016 (Cracked)

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


Try it online!

• I tried to make it as obfuscated as possible... – Mr. Xcoder Aug 3 '17 at 15:09
• @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 Aug 3 '17 at 15:10
• Cracked? – totallyhuman Aug 3 '17 at 15:14
• By the way, was that the intended solution? – totallyhuman Aug 3 '17 at 17:01
• @totallyhuman Yeah, it was the indtended solution. – Mr. Xcoder Aug 3 '17 at 17:16

# Japt, 13 bytes (Cracked)

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

p#A000012uCnG


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

• cracked? – officialaimm Aug 3 '17 at 16:06
• @officialaimm: Correct, nicely done. – Shaggy Aug 3 '17 at 16:11
• 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 Aug 3 '17 at 16:44
• @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 Aug 3 '17 at 23:05
• A020338 may also work if string input is allowed (1-indexed). – Bubbler Aug 30 '18 at 8:30

# MATL, 30 29 bytes (Cracked)

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


A077430

Try it online!

-1 byte thanks to @Sanchises

• Should be fixed now – Cinaski Aug 4 '17 at 6:57
• Just a hint: you can replace  3 by I for 1 byte. – Sanchises Aug 4 '17 at 8:11
• @Sanchises Thanks! Didn't knew I is initialized to 3 – Cinaski Aug 4 '17 at 8:29
• You 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 Aug 4 '17 at 8:52
• – user15259 Aug 4 '17 at 12:10

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

• It cannot be cracked yet >_< – Mr. Xcoder Aug 3 '17 at 14:47
• @Mr.Xcoder Can now :) – TheLethalCoder Aug 3 '17 at 14:47
• Craked (although not really cracked!) – Shaggy Aug 3 '17 at 14:49
• @Shaggy I just wanted to get the ball rolling :P – TheLethalCoder Aug 3 '17 at 14:50

# Python 2, 43 bytes, A000079 (Cracked)

Try it online

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

• Cracked? – TheLethalCoder Aug 3 '17 at 15:22
• @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 Aug 3 '17 at 15:24
• You changed it after posting? A bit unfair. – TheLethalCoder Aug 3 '17 at 15:26
• @TheLethalCoder I did it to protect from this false-positive sequence :C – Dead Possum Aug 3 '17 at 15:27
• I 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 Aug 3 '17 at 23:49

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

• Cracked – Lynn Aug 3 '17 at 16:11
• @Lynn What gave it away? The first sequence? – TheLethalCoder Aug 3 '17 at 16:12
• You 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 Aug 3 '17 at 16:15
• @Lynn Ah suppose, didn't think obfuscating that part. – TheLethalCoder Aug 3 '17 at 16:16

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

# Python 3, 65 bytes, A000027, cracked

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


Yay crazy arithmetic!

• 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 Aug 3 '17 at 22:31
• 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 Aug 3 '17 at 22:44
• Oh yes the offset - right (whew), thanks! Well cracked then. – Jonathan Allan Aug 3 '17 at 23:54

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

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.

• 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. – user15259 Aug 18 '17 at 1:06
• 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 Aug 18 '17 at 9:36

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

• – user15259 Aug 4 '17 at 13:28

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

• Feel very much like encryption/hashing. – pppery Aug 9 '17 at 2:09
• @ppperry - if that's against the rules, I'll remove it. – RootTwo Aug 9 '17 at 7:20
• Cracked? – Phlarx Aug 9 '17 at 18:56

# 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-cf3g8taz1
`
• 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! – user15259 Aug 7 '17 at 11:21
• 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 Aug 8 '17 at 14:14
• (Nevermind, I found counterexamples. My code is still 1-indexed.) – Phlarx Aug 8 '17 at 14:23
• 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 Aug 8 '17 at 15:14
• – user15259 Aug 10 '17 at 2:18