Lost in translation

15

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.

Post Rock Garf Hunter

Posted 2017-02-15T18:28:39.160

Reputation: 55 382

3How can a robber be sure that his answer is right for all inputs? Do they have to prove it mathematically? – Leo – 2017-02-15T18:41:35.857

"As per the usual answers that have been uncracked for 7 days can be marked safe." The "as per usual" should include that the answer is only safe once the intended solution has been revealed to ensure the answer's validity. – Martin Ender – 2017-02-15T18:44:44.590

1@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 – 2017-02-15T18:50:26.640

Can a cop make a function that he cannot prove to be correct? For example, mapping Mersenne number to the corresponding even perfect number is correct iff there are no odd perfect numbers, which is unknown. The robber still can crack this, because he mustn't prove anything. But it looks like the first requirement bans such things, because the perfect number sequences has not proven to be finite and you can't also be sure that you output all the existing terms. – Wolfram – 2017-02-15T19:51:24.733

2It'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 – 2017-02-15T20:25:25.230

@Wolfram I am going to have to side with Dennis at this point. You must be able to prove that your mapping will work. – Post Rock Garf Hunter – 2017-02-15T20:27:36.687

"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", what about languages with no arbitrary big integers? – betseg – 2017-02-15T20:51:17.393

@betseg for finite languages you must only work up to the limit of you language. – Post Rock Garf Hunter – 2017-02-15T20:56:21.593

1

I have a feeling that some really nice solutions can be cracked in a dumb way like https://oeis.org/A000004 -> https://oeis.org/A000012

– Wolfram – 2017-02-16T00:40:23.267

How come there is no robber's thread for this? – 0 ' – 2017-02-16T00:53:11.377

1@Wolfram Your input sequence must not have any repeat elements – Dennis – 2017-02-16T02:40:51.673

@1000000000 Because the robbers' thread's answers would consist of nothing but two OEIS identifiers. – Dennis – 2017-02-16T02:41:44.553

2@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 ' – 2017-02-16T02:46:39.830

Answers

6

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.

user62131

Posted 2017-02-15T18:28:39.160

Reputation:

@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. – None – 2017-02-15T20:44:49.737

@WheatWizard disable output cache makes sure you get a fresh result from the server, but that fresh result will still get cached. – Dennis – 2017-02-15T20:59:38.113

1@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 – 2017-02-15T21:03:18.167

+1 this answer is really simple in nature, but still poses a challenge to the robbers – user41805 – 2017-02-15T21:29:10.267

3http://oeis.org/A201647 -> http://oeis.org/A201648 – Wolfram – 2017-02-16T13:12:31.687

3

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.

Dennis

Posted 2017-02-15T18:28:39.160

Reputation: 196 637

3

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 – 2017-02-16T06:02:52.660

@JonathanAllan I came to A000040 -> A100626 as well, though you beat my slow fingers – Ahemone – 2017-02-16T06:08:13.030

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 – 2017-02-16T06:10:09.427

@JonathanAllan Yes, that's what I was going for. – Dennis – 2017-02-16T06:28:41.877

2

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.

user41805

Posted 2017-02-15T18:28:39.160

Reputation: 16 320

2

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.

betseg

Posted 2017-02-15T18:28:39.160

Reputation: 8 493

I assume the function in question is q? – Post Rock Garf Hunter – 2017-02-16T00:40:17.477

Also the variable k seems to be unused so you can save some bytes by removing it. – Post Rock Garf Hunter – 2017-02-16T00:44:32.523

Is it A001671 to A062964?

– Post Rock Garf Hunter – 2017-02-16T00:53:03.153

@WheatWizard yes, thanks, and yes. – betseg – 2017-02-16T04:07:07.390

0

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[100] evaluates to -3024847237.

Greg Martin

Posted 2017-02-15T18:28:39.160

Reputation: 13 940

2A003173 to A165892. Not really a programming problem, though ;) – Leo – 2017-02-16T12:02:29.953

2

Anyway, since mathematica isn't free, I wrote this to turn it into a python function

– Leo – 2017-02-16T12:10:59.903

@Leo: Great job! There's an Easter egg in the function too; did you find it? :D – Greg Martin – 2017-02-16T17:32:05.970

Uhhh... Nope :( – Leo – 2017-02-16T17:36:57.337

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 – 2017-02-16T17:40:33.763

I've tried to find something, but it's hard when the best method that comes to my mind is trying a lot of numbers and looking at the result to see if it's nice :) Any hint? – Leo – 2017-02-16T18:39:42.647

Sure, let's see: the secret input has four digits, and for it (just like for the other nine inputs), the integer-quotient is unnecessary—the polynomial value is exactly divisible by the 42-digit denominator. – Greg Martin – 2017-02-16T18:52:14.063

f(3173)=165892 is it that? – Leo – 2017-02-16T19:01:52.820

Let us continue this discussion in chat.

– Greg Martin – 2017-02-16T19:02:13.093

@Leo Mathematica IS free. http://www.wolfram.com/programming-lab/?source=nav

– mbomb007 – 2017-02-22T17:45:46.670