Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is the cops' thread. The robbers' thread goes here.

The last thread was already 4 months ago.

The cop's task

  • The cop's task is to write a program/function that takes a positive (or non-negative) integer and outputs/returns another number (not necessarily integer).
  • The cop will provide at least 2 sample inputs/outputs.
  • For example, if I have decided to write the Fibonacci sequence, I would write this in my answer:
a(0) returns 0
a(3) returns 2
  • The number of examples is up to the cop's discretion.
  • However, the sequence must actually exist in the On-Line Encyclopedia of Integer Sequences®, so no pseudo-random number generator for you. :(
  • No-ops (characters that do nothing) are not allowed
  • The cop can hide as many characters as is so wished.
  • For example, if my program is:

function a(n)
    if n>2 then
        return n
    else
        return a(n-1) + a(n-2)
    end
end

  • Then I would hide these characters as I want:

function a(n)
    if ### then
        ########
    else
        ######################
    end
end

The robber's task

  • is obviously to find the original source code.
  • However, any proposed source code that produces the same set of output also counts as valid, as long as it is also found in OEIS.

Tips for the cops

  • The search function in the OEIS only works for consecutive terms, so if you want to hide your sequence, then just leave a hole anywhere.
  • Apparently there is no way to hide the sequence. Put this in mind when you choose the sequence.

Your score is the number of bytes in your code.

The winner will be the submission with the lowest score that hasn't been cracked in 7 days.

Only submissions that are posted in 2016 April are eligible for the win. Submissions that are posted later than this are welcome, but cannot win.

In order to claim the win you need to reveal the full code and the OEIS sequence (after 7 days).

Your post should be formatted like this (NN is the number of characters):


Lua, 98 bytes

Output:

a(0) returns 0
a(3) returns 2

Code (# marks unrevealed characters):

function a(n)
    if ### then
        ########
    else
        ######################
    end
end

If the code is cracked, insert [Cracked](link to cracker) in the header. If the submission is safe, insert "Safe" in the header and reveal the full code in your answer. Only answers that have revealed the full code will be eligible for the win.

share|improve this question
1  
Also, OEIS search can have blanks with _, fyi – Sp3000 3 hours ago
1  
In your example you choose to reveal the spaces. Does that mean that you could just add as many spaces as you need in your submission to not reveal anything important? – user81655 3 hours ago
1  
@user81655 Yes, but that would count towards the byte count. – Kenny Lau 3 hours ago
1  
How is this open? It's totally unclear... – feersum 2 hours ago
1  
I'm voting to close as unclear because it's not made clear which parts of a program must be included in the output. I would suggest making the 20% unmasked rule apply to the entire submission, rather than just the ill-defined "critical parts". – Mego 1 hour ago

Jolf, 5 bytes, cracked

Output:

a(2) = 8
a(10) = 4738245926336

All of it is crucial, and I have shown 1 of 5.

####x

Original code:

mPm$x
mP     cube
  m$   catalan number
    x  input

Try it online!

share|improve this answer
    
Cracked! – Kenny Lau 2 hours ago
    
For anyone interested, it's this sequence: oeis.org/A033536 – Blue 2 hours ago

Jolf, 11 bytes

Output:

a(10) = 4
a(20) = 6
a(30) = 8

And the partially hidden code:

####xd###x#

I'm not sure if I can round down the number hidden like this, but the J answer implies that I can. If not, I can reveal one more.

(Also, I have no idea if this is too easy. I hope not.)

share|improve this answer
    
Show one more . – Kenny Lau 1 hour ago
    
@KennyLau Done. – QPaysTaxes 1 hour ago

Vim 36 keystrokes

i****<esc>:let @q="^*i****$**@***"<cr><n>@qbD

(Note: <n> is where you type your input)

Here is the code unrelated to number generation:

          :let @q="              "<cr><n>@qbD

Meaning I am revealing 5 out of 19 characters.

<n> is the input. Here are some sample outputs:

1@q:    1
2@q:    3
6@q:    18
share|improve this answer

Element, 10 bytes, cracked

Output:

a(3) = 6561
a(4) = 4294967296

There's probably only a few ways to compute this sequence in Element. I found a 9-char solution, but I figured this 10-char solution is actually more difficult. The # are hidden characters.

#_####@^#`

For convenience, here's the Try It Online and Esolang wiki pages.


The original was

2_3:~2@^^`
share|improve this answer
    
Show one more byte. – Kenny Lau 1 hour ago
    
@KennyLau I thought it was 1 out of 5? It's 10 bytes and I'm showing 3. – PhiNotPi 1 hour ago
    
Inputs and outputs don't count, so you have 8 bytes and you showed 1. – Kenny Lau 1 hour ago
    
@KennyLau done. – PhiNotPi 1 hour ago
    
Cracked. – Kenny Lau 55 mins ago

Element, 7 bytes

Output:

a(3) = 111
a(7) = 1111111

The # are hidden characters, and they are all printable ASCII. I think this one is actually reasonably difficult (for only having 5 missing characters).

###,##}

For convenience, here's the Try It Online and Esolang wiki pages.

share|improve this answer

Reng v.3.3, 36 bytes

Output:

a(1) = 2
a(3) = 15

# denotes a gone character. There are no other #s in the program.

i#:#+##-##)####¡#~
##########!</div>

Alright this is the last one for a while. Other people need to answer >_>. A description of each character can be found in the source code, where all the ops are defined. A comment proceeds each operator.

share|improve this answer

J, 7 bytes, cracked

Output:

a(0) = 6
a(2) = 27

Code (I have shown more for added difficulty):

#+#:###

Is a tacit verb.

share|improve this answer
    
Cracked. – Dennis 1 hour ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.