# Lost in translation

This is a if you are not familiar with the format click the tag to go to the wiki. There will not be a robbers' thread for this question.

# Cops

Your task as Cops is to select two sequences from the Online Encyclopedia of Integer Sequences and write a program that takes the nth element of one sequence as input and outputs the nth element of the second sequence. You then make an answer including the code and omitting the sequences selected. Robbers will attempt to find the sequences you selected and if one manages to find the sequences you had in mind or some other sequences for which your program you must mark your answer as Cracked. If a robber informs you with a crack that you believe is not valid you may present a proof that it is not a crack. Otherwise you must mark it so.

As per the usual answers that have been uncracked for 7 days are eligible to be marked safe. A Cop may mark their answer as safe by revealing the sequences that they had in mind. Once safe an answer may no longer be cracked.

The goal is to minimize the byte count of your program while remaining uncracked.

## Example

The following Python code translates the nth element of A000290 (the square numbers) into A000217 (the triangular numbers):

lambda x:sum(range(0,int(x**.5+1)))


# Stipulations and Requirements

• If you choose a sequence that has not been proven to be finite you must output all terms that might exist not just the ones listed on the OEIS page

• As an exception to the previous rule languages without infinite precision integers do not have to output or input numbers outside of their range.

• The size of your input sequence must not have been proven to be smaller than the output sequence.

• Your input sequence must not have any repeat elements (otherwise the task is pretty much impossible)

• The OEIS includes an index on their page (the first number after the "OFFSET" header) by default this is your offset for n (n equals the index for the first element on the sequence) if you choose another index you must indicate so in your answer.

• If you choose a offset different from the one listed on the OEIS you must still map all elements in your input sequence to the corresponding element in your output sequence.

• If your program receives an input that is not in the input sequence it may do whatever it wishes (undefined behavior). However it is probably in your best interest for it to still output an integer.

• It is unsportsmanlike to intentionally make your code difficult to run, be it by making it time consuming to execute or through non-free language selection. While I will enforce the latter I cannot objectively enforce the former. However I implore you, for the sake of fun, not to attempt the former as it makes the challenge specifically more difficult for those with weaker computers.

# Robbers

Your task as Robbers is to select uncracked, unsafe answers and find the sequences they map between. If you find solution a solution that works (not necessarily the Cops' intended solution) comment the sequences on the appropriate answer.

Robbers should not worry to much about verifying that two particular sequences are a solution, one should post a solution if it matches all of the entries on OEIS. If that is not the sequence that a cop had in mind the cop may offer a proof that it is incorrect or mark it as cracked if they cannot find one.

• How can a robber be sure that his answer is right for all inputs? Do they have to prove it mathematically? – Leo Feb 15 '17 at 18:41
• @Leo A robber should post a solution if it matches all of the entries on OEIS. If that is not the sequence that a cop had in mind they may offer a proof that it is incorrect or mark it as cracked if they cannot find one. I will update the robber's thread. – Post Rock Garf Hunter Feb 15 '17 at 18:50
• It's hard to draw the line between common assumptions and unproven ideas. In the interest of clarity, I'd say you have to be able to prove that your answer works. – Dennis Feb 15 '17 at 20:25
• I have a feeling that some really nice solutions can be cracked in a dumb way like oeis.org/A000004 -> oeis.org/A000012 – Wolfram Feb 16 '17 at 0:40
• @Dennis I guess that's a good point. It's a bummer though that there is no way for people to receive rep for finding cracks as it appears that that is pretty tricky for this challenge. – 0 ' Feb 16 '17 at 2:46

# Jelly, 14 bytes (Cracked by @Wolfram)

+66%444µ111<µ¡


Try it online!

It should be fairly obvious what this does. In fact, for the benefit of the non-Jelly users, I'll even give an explanation:

## Explanation

+66%444µ111<µ¡
µ    µ¡  Run the transformation
+66%444           "add 66, then modulo 444"
111<    once if 111 is less than the input, zero times otherwise


The question is, why does it do this?

## Crack

The sequences in question were A201647 and A201647. They're finite, and differ only in the last 2 elements:

• 3, 5, 7, 9, 11, 15, 21, 165, 693
• 3, 5, 7, 9, 11, 15, 21, 231, 315

Thus, if the input is low, I leave it the same, and I simply fit a function to the transformation of the last two.

• @WheatWizard: If you think you can get an advantage from that, go for it. But you'll have to be fast, as if someone else tests it with the cache enabled, they'll end up polluting the cache for everyone after them. – user62131 Feb 15 '17 at 20:44
• @WheatWizard disable output cache makes sure you get a fresh result from the server, but that fresh result will still get cached. – Dennis Feb 15 '17 at 20:59
• @WheatWizard Or add a cache breaker when you test it: a randomly selected string as part of a comment or an unused input field. – Dennis Feb 15 '17 at 21:03
• +1 this answer is really simple in nature, but still poses a challenge to the robbers – Kritixi Lithos Feb 15 '17 at 21:29
• – Wolfram Feb 16 '17 at 13:12

# Jelly, 7 bytes (Cracked by @JonathanAllan)

ÆFḅÆdÆẸ


Try it online!

### What it does

ÆFḅÆdÆẸ  Main link. Argument: n

ÆF       Factor n into prime-exponent pairs.
Æd    Compute σ, the number of divisors of n.
ḅ      Convert each pair from base σ to integer.
ÆẸ  Yield the integer whose prime signature (infinite sequence of all prime
exponents, including zeroes, in order) is equal to the result.

• There may well be other valid mappings, but the one that I think you had in mind was primes - A000040 to 2^(2p+1), p prime - A100626. – Jonathan Allan Feb 16 '17 at 6:02
• @JonathanAllan I came to A000040 -> A100626 as well, though you beat my slow fingers – Ahemone Feb 16 '17 at 6:08
• We can also see that it will hold: when the input is a prime, p, ÆF yields (p,1), and Æd yields 2, so ḅ gets us 2p+1, which means ÆẸ will yield the first prime, 2, raised to the power of that result, 2^(2p+1). – Jonathan Allan Feb 16 '17 at 6:10
• @JonathanAllan Yes, that's what I was going for. – Dennis Feb 16 '17 at 6:28

# Python 3, 256 bytes (Cracked!)

from math import*
def p(i,m):
r=0;d=floor(log(i))
for y in range(d):r+=(pow(16,d-y-1)%(8*y+m))/(8*y+m)
o=-1;y=d
while r!=o:o=r;r+=pow(16,d-y-1)/(8*y+m);y+=1
return r
def q(n):r=4*p(n,1)-2*p(n,4)-p(n,5)-p(n,6);return floor((1-(-r%1)if r<0 else r%1)*16)


Try it online!

Sorry if this code looks horrendous, I think this is my first Python golf. The casting in Python makes it easier to code.

• I assume the function in question is q? – Post Rock Garf Hunter Feb 16 '17 at 0:40
• Also the variable k seems to be unused so you can save some bytes by removing it. – Post Rock Garf Hunter Feb 16 '17 at 0:44
• Is it A001671 to A062964? – Post Rock Garf Hunter Feb 16 '17 at 0:53
• @WheatWizard yes, thanks, and yes. – betseg Feb 16 '17 at 4:07

# Processing, 184 bytes, SAFE!

int x(int y){int b=TRIANGLES-MITER;for(int i=OVERLAY/BURN;i>#fffffe;b*=(int)pow(y,(MOVE-HAND+0.)/(int)sqrt(red(color(-1<<16))/(int)log(color(0)*color(-1)))),i-=QUAD/DARKEST);return b;}


A function that takes in an int and returns an int. As long as the input number is in int's range, the program should work fine.

This isn't slow, just unreadable. Good luck!

I am surprised this submission has lasted this long. Oh well, at least it's the first safe submission :)

### A000578 to A000290

In other words: the cubes to the squares.

### Explanation

While answering No strings (or numbers) attached, I discovered a list of Processing constants that represent ints. For example, CORNER has a value of 0. The full list can be found here. To find the value of a constant, you can just print it.

Using this, I decided to swap certain numbers with combinations of these constants to obfuscate it. So, here's what you get when you substitute the constants with their respective int values.

int x(int y){int b=9-8;for(int i=512/8192;i>#fffffe;b*=(int)pow(y,(13-12+0.)/(int)sqrt(red(color(-1<<16))/(int)log(color(0)*color(-1)))),i-=16/16);return b;}


Even now, the full clear code isn't revealed. The colours are remaining. In Processing, colour variables have int values, for example white (#ffffff) is -1, #fffffe is -2, #fffffd is -3, and so on. This can be found by printing the colour. So let's simplify the colours.

int x(int y){int b=9-8;for(int i=512/8192;i>-2;b*=(int)pow(y,(13-12+0.)/(int)sqrt(red(color(-1<<16))/(int)log(-16777216*-1))),i-=16/16);return b;}


We're about halfway there :) To understand the values, we need to simplify the numerical expressions.

int x(int y){int b=1;for(int i=0;i>-2;b*=(int)pow(y,(1.)/(int)sqrt(red(color(-65536))/(int)log(16777216))),i-=1);return b;}


Much clearer! Now let's simplify the logarithm.

int x(int y){int b=1;for(int i=0;i>-2;b*=(int)pow(y,(1.)/(int)sqrt(red(color(-65536))/(int)16.6...)),i-=1);return b;}

int x(int y){int b=1;for(int i=0;i>-2;b*=(int)pow(y,(1.)/(int)sqrt(red(color(-65536))/16)),i-=1);return b;}


Almost over! Now we have to figure out this (int)sqrt(red(color(-65536))/16)) mouthful. color(-65536) is red, so rgb(255, 0, 0). Now the red() function returns the value of the red component in the argument (which is a colour). So how much red is there in red? The answer is 255. With that we get

(int)sqrt(255/16))
(int)sqrt(15)
(int)3.8...
3


Substituting this in the program results in:

int x(int y){int b=1;for(int i=0;i>-2;b*=(int)pow(y,(1.)/3),i-=1);return b;}


Yay, it's done!

int x(int y){                        // y is the cube
int b=1;                           // variable that holds the final result
for(int i=0;                       // for-loop that
i>-2;                      // loops twice
b*=(int)pow(y,(1.)/3),     // multiply b by the cube root of y
i-=1);                     // decrement the looping variable
return b;                          // finally return b
}


To sum it up, this returns the square (done by multiplying twice in the for-loop) of the cube root of the input number.

# Mathematica (or whatever) — Cracked!

f[x_] := Quotient[ 366403414911466530559405368378193383110620062 -
755296348522256690003418238667147075159564695 x +
525778437135781349270885523650096958873079916 x^2 -
156594194215500250033652167655133583167162556 x^3 +
20861131421245483787723229627506507062999392 x^4 -
1181515772235154077024719095229309394979146 x^5 +
29382627265060088525632055454760915985604 x^6 -
308672970015057482559939241399297150364 x^7 +
1087516675449597417990589334580403666 x^8 -
312989984559486345089577524231879 x^9,
265451130886621254401938908479744271974400 ]


I know Mathematica is non-free software, but this function is trivial to port to whatever favorite language you want to run it in. It literally computes the value of the given degree-9 polynomial evaluated at the input integer, then takes the integer quotient of that value and the 42-digit number on the last line. For example, f evaluates to -3024847237.

• A003173 to A165892. Not really a programming problem, though ;) – Leo Feb 16 '17 at 12:02
• Anyway, since mathematica isn't free, I wrote this to turn it into a python function – Leo Feb 16 '17 at 12:10
• @Leo: Great job! There's an Easter egg in the function too; did you find it? :D – Greg Martin Feb 16 '17 at 17:32
• Uhhh... Nope :( – Leo Feb 16 '17 at 17:36
• To map one nine-element set to another nine-element set, I'd only need a polynomial of degree 8. You could draw the (correct) conclusion that there's one more input value I mapped to a specific output value. Let me know if (when) you find it :) – Greg Martin Feb 16 '17 at 17:40