Find the program that prints this integer sequence (Cops' thread)

39

7

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 integer.
  • The cop must state it if the program is intolerant towards zero.
  • 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. :(
  • 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.

Leaky Nun

Posted 2016-04-09T00:54:10.967

Reputation: 45 011

Just to clarify: if I post a cop which specifies a(0) = 1, a(1)= 1 with the Fibonacci sequence in mind, and a robber posts a crack which outputs the constant 1 sequence (i.e. not what I had in mind), then does this count as cracked? – Sp3000 – 2016-04-09T00:59:03.623

2Also, OEIS search can have blanks with _, fyi – Sp3000 – 2016-04-09T00:59:14.110

Also "the parts of the code not related to the number generation must be revealed" seems a bit confusing to me. Suppose I posted an answer in Brainfuck - which parts would that be? – Sp3000 – 2016-04-09T01:01:03.307

1In 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 – 2016-04-09T01:06:52.793

@Sp3000 Re "OEIS search can have blanks": Then how would I hide the sequence? – Leaky Nun – 2016-04-09T01:07:17.957

1@user81655 Yes, but that would count towards the byte count. – Leaky Nun – 2016-04-09T01:07:31.193

@Sp3000 Re "a robber posts a crack which outputs the constant 1 sequence": "However, any proposed source code that produces the same set of output also counts as valid (you are encouraged to reproduce an actual sequence in the OEIS)." – Leaky Nun – 2016-04-09T01:08:13.660

@Sp3000 Re "a(0) = 1, a(1)= 1 with the Fibonacci sequence in mind": a(0)=0. – Leaky Nun – 2016-04-09T01:10:22.490

So if I have, say, 31 characters, do I have to show six or seven of them? – Fund Monica's Lawsuit – 2016-04-09T02:19:10.890

9It may be too late to change, but allowing sequences that are multiples of an OEIS sequence, and/or only include every nth term would have made this challenge much better. sandbox, hint, hint – Nathan Merrill – 2016-04-09T02:37:57.540

I don't think that is necessary. – Leaky Nun – 2016-04-09T03:20:59.397

6Can I, for example, pick the Fibonacci sequence and provide only a(1000)? (which is part of the sequence, but too large to be searchable on OEIS) – Sp3000 – 2016-04-09T06:36:06.617

2I'd say the values have to actually be searchable on OEIS, so that it can easily be verified that the values are correct for the chosen sequence. – Mego – 2016-04-09T06:38:59.647

3"Intolerant towards zero" makes no sense. What is that supposed to mean? – feersum – 2016-04-10T23:28:12.387

@feersum I would believe it means whether or not the program outputs the sequence starting with 0 or 1, but I'd also like clarification. – Mego – 2016-04-11T01:37:13.303

1In your example program I think you meant n<2 – Cyoce – 2016-04-11T05:03:57.183

Can cops post more than one answer? – ASCIIThenANSI – 2016-04-11T21:06:16.013

I don't understand... What is a "Safe" answer ? – FliiFe – 2016-04-16T16:11:14.660

@FliiFe An answer that doesn't get cracked in a week. – Leaky Nun – 2016-04-16T16:14:25.677

@KennyLau After a week, an answer cannot be cracked anymore, can it ? – FliiFe – 2016-04-16T16:18:30.990

Nope, it cannot. – Leaky Nun – 2016-04-16T16:19:30.483

Answers

11

Vim, 36 keystrokes -- Safe!

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

Answer

This code prints The Lucas Numbers (A000032), which are just like The Fibonnaci Sequence, except that it starts on 2, 1 instead of 1, 1. Here are the first 15 numbers:

2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843

Here's the revealed code:

i2 1 <esc>:let @q="^diwwyw$pb@-<c-v><c-a>"<cr><n>@qbD

Explanation:

i2 1 <esc>                          "Insert the starting numbers
          :let @q="....."<cr>       "Define the macro 'Q'

Explanation of the macro:

^                      "Move to the first non-whitespace character on the line.
 diw                   "(d)elete (i)nner (w)ord. This is different then 'dw' because it doesn't grab the space. 
                      "It also throws people off since 'i' is usually used for inserting text.
    wyw$               "Move to the next number, yank it then move to the end of the line 
        pb             "(p)aste the yanked text and move (b)ack
          @-     <c-a> "@- is the register holding the word we deleted. Increment the current number that many times.
            <c-v>      "Since we're adding <c-a> this from the command line, we need to type it as a literal.

Now, we just need to remove the second number, since the first number is the lucas number we want. So we do

b   "move (b)ack
 D  "(D)elete to the end of the line.

Also, if I'm not mistaken, this is the first safe submission! That's kinda cool.

James

Posted 2016-04-09T00:54:10.967

Reputation: 54 537

I know the sequence, I think. I just don't know how to turn it into Vim keystrokes. – Fund Monica's Lawsuit – 2016-04-09T06:54:12.663

Is the output just the number or the entire line? – ASCIIThenANSI – 2016-04-11T20:51:03.083

@ASCIIThenANSI After hitting bD at the end, the output is just the one number and some extra whitespace. – James – 2016-04-11T20:58:15.543

I got the sequence right! – Fund Monica's Lawsuit – 2016-04-16T04:58:14.667

8

05AB1E, 5 bytes, safe

Last one for today :p. Output:

a(0) = 9
a(5) = 4
a(10) = 89

Code:

___m_

Obfuscated characters are indicated with _. Try it online!-link. Uses CP-1252 encoding.


Solution:

žhžm‡

Explanation:

žh       # Short for [0-9].
  žm     # Short for [9-0].
    ‡    # Translate.

Try it online! or Try for all test cases!.

Adnan

Posted 2016-04-09T00:54:10.967

Reputation: 41 965

I know the sequence, just not how to generate it in so few bytes... – LegionMammal978 – 2016-04-09T20:26:26.550

@LegionMammal978 Yes, I think that is going to be the hardest part of this one. – Adnan – 2016-04-09T20:57:42.563

I can get it in 5 bytes with g°<¹- but I can't figure out any way to use m at this size! D: – user81655 – 2016-04-11T00:42:23.130

@user81655 Yes, that was the alternative solution :). – Adnan – 2016-04-11T04:39:31.133

6

Element, 7 bytes, cracked

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.


My original program was:

_'[,$ ` }

The trick is that

] and } are functionally identical (both translate to } in Perl). Also, I used ,$ to produce a 1 as an additional layer of confusion, although it is possible to ignore the , completely by doing ,1 instead.

PhiNotPi

Posted 2016-04-09T00:54:10.967

Reputation: 26 739

(I know I shouldn't ask this, but) are you sure that it is correct? In particular, } instead of ]? – Leaky Nun – 2016-04-09T05:18:41.430

@KennyLau The } is correct, and my program (as far as I know) works in every version of Element. – PhiNotPi – 2016-04-09T05:20:44.257

Cracked. – Leaky Nun – 2016-04-09T06:07:33.630

I think the formatting is wrong in your original code? – Rɪᴋᴇʀ – 2016-04-09T21:46:33.073

@EasterlyIrk It is. If you know how to fix it, be my guest. – PhiNotPi – 2016-04-09T21:55:24.310

@PhiNotPi fixedish. – Rɪᴋᴇʀ – 2016-04-09T21:58:23.593

5

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!

Conor O'Brien

Posted 2016-04-09T00:54:10.967

Reputation: 36 228

Cracked! – Leaky Nun – 2016-04-09T01:33:47.737

1

For anyone interested, it's this sequence: https://oeis.org/A033536

– Blue – 2016-04-09T01:34:44.180

5

JavaScript (ES7), 10 bytes, Cracked

Output

f(0) -> 1
f(1) -> -1

Code

t=>~t##**#

Test it in Firefox nightly. The code is an anonymous function. This will probably be easy since there's only three characters hidden, but at least it's short! :P


My original code was:

t=>~top**t

but after brute-forcing my own code for a solution, I soon realised

t=>~t.x**t (where x can be any variable name character)

could also be used. This works because

in the original ES7 exponentiation operator spec, the operator had lower precedence than unary operators (unlike conventional mathematics and most other languages). ~ performs a bitwise NOT on t.x (undefined) or top (Object) which casts them to a 32-bit signed integer (uncastables like these become 0) before doing the NOT (so 0 becomes -1). I looked into further into this, and very recently, the spec has changed to disallow ambiguous references like this (not good for future golfing D: ), however most ES7 engines haven't updated to the latest version of the spec yet.

user81655

Posted 2016-04-09T00:54:10.967

Reputation: 10 181

1@insertusernamehere It seems to think it contains an illegal expression. It does work in Firefox nightly though. I guess they implement the ES7 spec differently. – user81655 – 2016-04-13T09:33:44.683

I just got Firefox nightly, and I must complain that this does not work there. 32-bit windows from here

– Conor O'Brien – 2016-04-13T21:11:40.827

Assuming ** is equivalent to Math.pow, I have done some of my own testing, and even run a brute force. This is quite hard to crack! – Conor O'Brien – 2016-04-13T21:42:51.100

@CᴏɴᴏʀO'Bʀɪᴇɴ My Firefox nightly is up to date as of yesterday. I'm using OS X but I'm quite sure it will work in Windows also. Traceur with appropriate ES7 options enabled transpiles it correctly too.

– user81655 – 2016-04-13T22:30:15.460

@CᴏɴᴏʀO'Bʀɪᴇɴ Just tried it in 32-bit Windows from your link and it works also. I'm surprised your brute force search couldn't crack it. I actually just realised there's many solutions to this! D: – user81655 – 2016-04-13T23:40:44.557

@user81655 Weird. I've been assuming the problem is of the form t=>~t<op><data>**<data>, where <op> is any unary operator and <data> is any of 0123456789t. – Conor O'Brien – 2016-04-13T23:42:52.623

@CᴏɴᴏʀO'Bʀɪᴇɴ Well who knows, anything could be under the hashes... :P – user81655 – 2016-04-13T23:46:33.573

Cracked? – insertusernamehere – 2016-04-14T07:03:19.087

In my cellphone appear above, some yellow (giallo) rectangles voids – RosLuP – 2016-10-20T09:18:17.310

4

05AB1E, 4 bytes (Cracked)

Sample output :

a(5) = 51
a(8) = 257

And for the code :

###^

I revealed the last one. Should be easy enough though, I had quite a hard time finding a sequence :(

All hidden characters are printable.

Paul Picard

Posted 2016-04-09T00:54:10.967

Reputation: 863

1Cracked! :) – Adnan – 2016-04-09T09:32:46.687

4

MATL, 5 bytes, cracked

Hidden characters are indicated by %.

%5%*%

Output:

a(1) = 3
a(2) = 6
a(4) = 12

Input 0 is valid.


Original code:

35B*s

that is,

35    % push number 35
B     % convert to binary: array [1 0 0 0 1 1]
*     % multiply element-wise by implicit input n: gives [n 0 0 0 n n]
s     % sum of array: gives 3*n

Luis Mendo

Posted 2016-04-09T00:54:10.967

Reputation: 87 464

2Hmmm, the five in code is very annoying! – Adnan – 2016-04-09T12:27:04.040

Technically this could be brute-forced by a program... but I won't do that. – Leaky Nun – 2016-04-09T12:37:57.123

1cracked – flawr – 2016-04-09T19:19:55.510

4

SWIFT, 55 bytes, Cracked

func M(n:Int)->Int{
return(n*****) ?M(**n****):n***;
}

* marks a hidden character

Output:

M(30) -> 91
M(60) -> 91
M(90) -> 91
M(120)-> 110
M(150)-> 140

Function accepts 0

Nefrin

Posted 2016-04-09T00:54:10.967

Reputation: 141

1Cracked – Emigna – 2016-04-14T09:45:31.393

4

Ruby, 46 bytes, safe

Edit to add disclaimer/apology: This sequence starts with f[0], while the OEIS entry starts with f[1]. The values are the same.

Obfuscated code (# is any character):

->####or x##1###(#..##0#);x*=3;end;#.###ect:+}

Call like

->####or x##1###(#..##0#);x*=3;end;#.###ect:+}[3] (returns 39)

Output:

f[0] = 0
f[1] = 3
f[2] = 12
f[3] = 39
f[4] = 120
f[5] = 363
f[6] = 1092
f[7] = 3279
f[8] = 9840
f[9] = 29523

Solution:

f=->*x{for x[-1]in(0..x[0]);x*=3;end;x.inject:+}

Sequence:

http://oeis.org/A029858

Explanation:

The minor trick here is that we declare the parameter as *x rather than x. This means that if you pass in 2, x is set to [2]...at first. The major trick exploits bizarre, and justly obscure, Ruby syntax where you can set the iterator in a for loop to any valid left hand side of an assignment expression, instead of an iterator variable like i. So this loops through from 0 to (in this example) 2, assigning each number to x[-1], meaning it overwrites the last value of x. Then the loop body x*=3, further mutates x by concatenating it to itself 3 times. So first x becomes [0], then [0,0,0]. On the next loop it becomes [0,0,1], then [0,0,1,0,0,1,0,0,1]. Finally we pass in 2 and it becomes [0,0,1,0,0,1,0,0,2], then [0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2]. We then sum the result using the inject method, which reduces the array by applying + (the passed in method) to each element in turn. If we consider how each iteration changes the sum, we see that we effectively add 1 (by overwriting the last element with an element one higher), then multiply by 3. Since 3*(n+1) = 3*n + 3, this implements Alexandre Wajnberg's recurrence relation for the sequence as described on the page.

histocrat

Posted 2016-04-09T00:54:10.967

Reputation: 20 600

I really like your cops here, this one particularly. Well done. – Not that Charles – 2016-04-13T14:27:13.863

3

05AB1E, 3 bytes, cracked

Output:

a(9) = 165
a(10) = 220

Hidden code:

##O

Try it online might come in handy.

Adnan

Posted 2016-04-09T00:54:10.967

Reputation: 41 965

Cracked. – Leaky Nun – 2016-04-09T07:50:38.773

3

Hexagony, 7 bytes, cracked

Output:

a(1) = 2
a(2) = 4

Hidden code:

?#####@

Or alternatively:

 ? #
# # #
 # @

Try it online might come in handy.

Adnan

Posted 2016-04-09T00:54:10.967

Reputation: 41 965

Cracked. – Martin Ender – 2016-04-09T08:42:41.977

Uhhh wait, does your code work for input 0? – Martin Ender – 2016-04-09T08:44:49.427

@MartinBüttner Oh, it doesn't, my bad. Your solution was the right one though. – Adnan – 2016-04-09T09:03:40.413

3

PHP, 41 bytes, cracked

Yeah, finally another Cops and Robbers challenge. Hope I didn't make it to easy.

Output

a(5)   = 0
a(15)  = 1
a(35)  = 0
a(36)  = 1
a(45)  = 1

Source

____________________$argv[1]____________;
####################        ############

Notes


Cracked

I obviously made it to easy and provided not enough examples. The sequence I had in mind was A010054:

a(n) = 1 if n is a triangular number else 0.

Here's my original source code:

echo(int)($r=sqrt(8*$argv[1]+1))==$r?1:0;

It tests whether the input is a triangular number and outputs 1 or 0 accordingly.

insertusernamehere

Posted 2016-04-09T00:54:10.967

Reputation: 4 551

Cracked. – LegionMammal978 – 2016-04-09T15:35:09.043

3

Pyke, 15 bytes, SAFE

Output

a(2) = 21
a(15) = 17

Revealed code:

#R#D######+##)#

Solution:

OEIS A038822
wR}DSR_Q*L+#P)l
I used a couple of red herrings here by using wR} to generate the number 100 and revealing the character R which is normally used to rotate the stack. I also used #P)l instead of the more simple mPs to count the number of primes in the sequence.

Blue

Posted 2016-04-09T00:54:10.967

Reputation: 26 661

The sequence in question starts from n=1 not n=0 by the way – Blue – 2016-04-09T11:09:07.300

I thought it was that sequence, except it starts at n=0 and not n=1 as you've stated. – Emigna – 2016-04-18T11:07:50.987

3

C, 71 bytes cracked

############
#####
main(){
 scanf("%d",##);
 ###6#;
 printf("%d",##);
}

Output:

a(1) = 0   a(2) = 0   a(5) = 1
a(6) = 1   a(7) = 1   a(9) = 2

This works with gcc, and is a full program. It accepts 0 as input.

mIllIbyte

Posted 2016-04-09T00:54:10.967

Reputation: 1 129

Cracked. – feersum – 2016-04-11T00:16:39.677

Well, I should've revealed more characters. I posted a different one, and I tried to avoid function calls. http://codegolf.stackexchange.com/a/77583/52554

– mIllIbyte – 2016-04-11T11:17:04.170

3

Jolf, 11 bytes, Cracked , A011551

c*______x__

c*mf^+91x~P

Original code:

c*^c"10"x~P

Examples:

0 -> 1

12 -> 1618033988749

Rɪᴋᴇʀ

Posted 2016-04-09T00:54:10.967

Reputation: 7 410

Cracked. – Adnan – 2016-04-09T22:07:07.783

@Adnan Good job, though different from mine. And you couldn't figure out first op. :P – Rɪᴋᴇʀ – 2016-04-09T22:17:12.873

Yeah, I couldn't figure out what it does :p – Adnan – 2016-04-09T22:30:22.570

@Adnan it was a cast to int function, misused as a floor one. – Rɪᴋᴇʀ – 2016-04-09T23:02:38.133

3

Java, 479 bytes, Cracked

Outputs:

a(10) = 81
a(20) = 35890

(Inputs are provided via command line arguments)

Code (# marks hidden characters):

import java.util.*;
public class A{

    public static int#########
    public boolean###########

    static A a = new A();

    public static void main(String[] args){
        int input = Integer.parseInt(args[0]);

        LinkedList<Integer> l = new LinkedList<>();
        l.add(1);
        l.add(0);
        l.add(0);

        for(int ix = 0; ################if(##>##{
            ###########d#
            #######+##p##########+##########(#######
        }

        System.out.println(#########################
            ###(A.#############(#5#####)));
    }
}

The program starts at index 0.

(Note that SE replaces all of the \t indents with 4 spaces, bringing the byte total to 569. Click here to see the program with \t indents instead of space indents.)

Original code:

import java.util.*;
public class A{
    public static interface B{
    public boolean C(int i);} 

    static A a = new A();

    public static void main(String[] args){
        int input = Integer.parseInt(args[0]);

        LinkedList<Integer> l = new LinkedList<>();
        l.add(1);
        l.add(0);
        l.add(0);

        for(int ix = 0; ix<input; ix++)cif(i->  {
            return l.add(
            l.pop()+l.peekFirst()+l.peekLast());});{    
        }

        System.out.println(l.get(1));}static boolean 
            cif(A.B b5){return (b5.C((0)));
    }
}

(Same code, but formatted normally):

import java.util.*;

public class A {
    public static interface B { //functional interface for lambda expression
        public boolean C(int i); //void would have given it away
    }

    static A a = new A(); //distraction

    public static void main(String[] args) {
        int input = Integer.parseInt(args[0]);//Input

        LinkedList<Integer> l = new LinkedList<>();
        l.add(1);//Set up list
        l.add(0);
        l.add(0);

        for (int ix = 0; ix < input; ix++)
            cif(i -> { //Fake if statement is really a lambda expression
                return l.add(l.pop() + l.peekFirst() + l.peekLast());
            });
        { //Distraction
        }

        System.out.println(l.get(1));//Output
    }

    static boolean cif(A.B b5) { //Used to pass in lambda expression.
                  //The A. and b5 were both distractions
        return (b5.C((0)));
    }
}

Daniel M.

Posted 2016-04-09T00:54:10.967

Reputation: 3 737

Hm, how do you come to a byte count of 488? I count 545 from i to }?
And please specify 0-tolerance.
– Vampire – 2016-04-09T23:46:16.070

Aren't your examples a(9) and a(19) or a(8) and a(18), according to which version of it on OEIS you took? – Vampire – 2016-04-09T23:54:31.317

@BjörnKautler I'll post a link to the byte counter when I get home. What do you mean by 0-tolerance? The first value is a(1) = 0 – Daniel M. – 2016-04-09T23:55:49.793

From the OP: "The cop's task is to write a program/function that takes a positive (or non-negative) integer and outputs/returns another integer. The cop must state it if the program is intolerant towards zero." So I guess you take the input 1 as 0 and this also explains the shift in position, according to the OEIS sequence. – Vampire – 2016-04-09T23:58:16.470

@BjörnKautler OK, thanks. The program doesn't crash if 0 is entered but the sequence starts at index 1, so I guess it's zero-intolerant. – Daniel M. – 2016-04-10T00:02:59.897

Are you sure? The only matching sequences I found on OEIS that match your samples start at 0 and for one the results would be a(9) and a(19), for the other a(8) and a(18) – Vampire – 2016-04-10T00:33:52.677

@BjörnKautler OEIS is 0-indexed? I'll change it then (in about an hour). Thanks – Daniel M. – 2016-04-10T00:37:30.193

Depends on the sequence. The one you most probably used says with a(0)=a(1)=0, a(2)=1 and also specifies the offset to be 0, which means the first value in the shown numbers is the 0-value. You can also click on the list link after the numbers and you get a list with n-to-a(n) mapping. – Vampire – 2016-04-10T00:42:42.023

@BjörnKautler I'm not all that familiar with OEIS so that's good to know. I need to test it before I change this post, but to make the code 0-indexed, "int ix = 1" should become "int ix = 0" – Daniel M. – 2016-04-10T00:50:24.390

Me neither. Just learned about OEIS some minutes ago when I recognized this challenge :-) – Vampire – 2016-04-10T00:51:41.990

@BjörnKautler It seems that SE replaces all tab indents with space indents, upping the byte count. I added a note to clarify the byte situation. Also, I fixed the 0-indexing. Have fun :) – Daniel M. – 2016-04-10T01:08:21.790

Ah, tabs-vs-4spaces makes sense. And the newlines are also counted as 1 just as in the example, I see. :-) Thanks for clarification. One more question. I almost have it cracked, just a(0) and a(1) are wrong for me, all others are correct. You are sure the first two are calculated correctly by your code, aren't you? :-) – Vampire – 2016-04-10T01:31:55.327

@BjörnKautler I double checked, and they are. Mind if I move the discussion to chat? – Daniel M. – 2016-04-10T01:46:01.543

No need, it is cracked. :-)

– Vampire – 2016-04-10T02:06:45.800

@BjörnKautler Was not expecting that so quickly (or so differently), given that the original had no if statement, and had a second method. – Daniel M. – 2016-04-10T02:13:04.123

Or a ternary operator. :-D Yeah, I was pretty sure the original code is differently, but also didn't imagine that much. I didn't really expect an interface, an additional method or a lambda here. But the better for me, there was so much room, that I was able to fit in my code and comment out your revealed characters. :-D Though yours will not get an OutOfMemoryError, mine will if you give it a big enough n, as I continuously build up the ArrayList. :-) – Vampire – 2016-04-10T02:40:56.093

That was pretty funny, I should more often solve those :-D – Vampire – 2016-04-10T02:43:40.220

3

Octave, 34 bytes, cracked

@(m)(m###m#####m##)&isprime(#)####

Outputs:

ans(1) = 0
ans(6) = 5
ans(7) = 10
ans(8) = 15

The sequence starts at ans(1) in OEIS.

Stewie Griffin

Posted 2016-04-09T00:54:10.967

Reputation: 43 471

Cracked. – feersum – 2016-04-10T19:45:00.353

3

MATL, 9 bytes, Cracked

Code:

3#2###*##

Output:

a(1)  = 3
a(2)  = 6
a(4)  = 12
a(12) = 37

a(0) is valid.


Cracked

Original sequence: A059563

Original code:

3L2^Ze*sk
3L          % Push [1 -1j] from the clipboard
  2^        % square
    Ze      % exp
      *     % times input
       s    % sum
        k   % floor

beaker

Posted 2016-04-09T00:54:10.967

Reputation: 2 349

Cracked. – Adnan – 2016-04-09T22:55:44.483

3

Pyth, 70 bytes, Cracked

DhbI|qb"#"qb"#"R!1Iqb"#"#####+""s####2###;##lY+Q1Ih+""Z#####)=Z+Z1;@YQ

# are the hidden characters

Has been cracked, so here is the versionn without hidden chars :

DhbI|qb"4"qb"0"R!1Iqb"1"R!0Rh+""sm^sd2cb1;W<lY+Q1Ih+""Z=Y+YZ)=Z+Z1;@YQ

Sample outputs :

a(2) -> 10
a(4) -> 19

Good luck to find this on OEIS, I personally failed to find it from those examples (even tho the sequence is quite easy to spot.)

FliiFe

Posted 2016-04-09T00:54:10.967

Reputation: 543

Cracked. – Adnan – 2016-04-10T19:39:33.330

3

Lua, 45 Bytes, Cracked

A small hint:

a(0) will make the program crash :)

Output

a(1)=>0
a(2)=>1

Code

Uses # to hide the code :).

a=function(n)#####n###### and #or ########end

I was using the OEIS A007814, with the following code:

a=function(n)return n%2>0 and 0or 1+a(n/2)end

Katenkyo

Posted 2016-04-09T00:54:10.967

Reputation: 2 857

Cracked. – Leaky Nun – 2016-04-14T09:36:22.017

@KennyLau Well done, I've added the OEIS I was thinking to and the intended code, I should have added at least one more output to prevent this to happen :p – Katenkyo – 2016-04-14T09:42:25.697

3

C, 82 bytes, safe

####=############
main(i){scanf("%d",##);
for(i=1;i++/4<#;)##=2;
printf("%d",##);}

Works with gcc, and it is a full program, which reads its input from stdin and prints its output to stdout. Here the sequence is A004526, floor(n/2).

a(0) = 0    a(1) = 0    a(2) = 1
a(3) = 1    a(4) = 2    a(5) = 2
a(6) = 3    a(7) = 3    a(8) = 4

Solution:

a;*b=(char*)&a+1;
main(i){scanf("%d",&a);
for(i=1;i++/4<2;)a*=2;
printf("%d",*b);}

This works only on little endian machines, and only if the size of char is 1 byte.
And only if the byte higher than the highest order byte of a has value 0. I think this is true for gcc since by default uninitialized global variables go into the bss segment, and initialized global variables go into the data segment (see https://stackoverflow.com/questions/8721475/if-a-global-variable-is-initialized-to-0-will-it-go-to-bss).
So only a goes into bss (the only other global variable b is initialized and thus goes into the data segment). If a is not at the end of bss, then the byte higher than the highest order byte of a is also in bss and thus has value 0.

mIllIbyte

Posted 2016-04-09T00:54:10.967

Reputation: 1 129

Try making function calls now :) – mIllIbyte – 2016-04-11T11:22:19.667

1I don't think you had to specify the sequence... – FliiFe – 2016-04-11T13:35:57.087

@FliiFe - Fixed :) – mIllIbyte – 2016-04-11T13:39:35.993

3

Ruby, 38 bytes, cracked

Obfuscated code (# can be any character):

->#{(s=#########).sum==#3333&&eval(s)}

Output:

Multiplies the input by 10 (A008592). Works for any integer, including 0. e.g.

->#{(s=#########).sum==#3333&&eval(s)}[3]  => 30
->#{(s=#########).sum==#3333&&eval(s)}[10] => 100

histocrat

Posted 2016-04-09T00:54:10.967

Reputation: 20 600

Cracked. – xsot – 2016-04-12T06:40:01.177

3

05AB1E, 5 bytes, cracked

Output:

a(0) = 0
a(1) = 0
a(2) = 1
a(3) = 1
a(4) = 1
a(5) = 1
a(6) = 1
a(7) = 1
a(8) = 1
a(9) = 1
a(10) = 0
a(11) = 0

Obfuscated code:

_____

Try it online!-link.

Adnan

Posted 2016-04-09T00:54:10.967

Reputation: 41 965

1Cracked. – jimmy23013 – 2016-04-12T13:22:22.773

3

05AB1E, 4 bytes, cracked

Well then, I think I'm addicted to CnR's... Obfuscated code (_ indicates a wild card):

____

Sequence:

a(1) = 2
a(4) = 6720

The sequence in OEIS starts at a(1) = 2.

Try it online!-link

Adnan

Posted 2016-04-09T00:54:10.967

Reputation: 41 965

Cracked – David – 2016-04-13T04:28:56.387

3

05AB1E, 1 byte, Cracked

_

_ denotes hidden code.

f(1) == 1
f(18) == 6

penalosa

Posted 2016-04-09T00:54:10.967

Reputation: 505

Cracked – Emigna – 2016-04-27T06:11:13.383

2

Reng v.3.3, 36 bytes. Cracked, A005449

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.

Original code:

i>:1+(1-?v)v/a+¡n~
~^<$:$:$:>!</div>

Conor O'Brien

Posted 2016-04-09T00:54:10.967

Reputation: 36 228

Cracked. – Leaky Nun – 2016-04-09T05:52:59.167

What is the original sequence? – Leaky Nun – 2016-04-10T00:06:14.000

+1 for </div>, an HTML tag that strangely appeared in this code. I like finding out secrets like this. :-P – user48538 – 2016-04-17T13:17:54.630

@zyabin101 XD Thanks! I put it there as a red herring. – Conor O'Brien – 2016-04-17T18:36:27.300

2

Jolf, 11 bytes, Cracked.

Output:

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

And the partially hidden code:

####xd###x#

Hint:

When I looked through the sequences in order, I didn't go very far before finding this one.

The cracked version isn't quite the same as my original code. I'm not currently at my computer, so I don't have it exactly, but it was something like this:

l fzxd!m%xH

(The only part I'm unsure about is the !m. It's whatever checks if a variable is zero.)

Fund Monica's Lawsuit

Posted 2016-04-09T00:54:10.967

Reputation: 564

I found the sequence... Pity I don't know Jolf or javascript very well :( – Blue – 2016-04-09T10:57:08.373

@muddyfish, Same here... – LegionMammal978 – 2016-04-09T11:00:14.720

Well, I guess it's time for the master to do it... may I? – Conor O'Brien – 2016-04-09T14:31:38.657

@CᴏɴᴏʀO'Bʀɪᴇɴ If everyone else is stumped – and it looks like they are – feel free. – Fund Monica's Lawsuit – 2016-04-09T14:32:17.863

Cracked. – Conor O'Brien – 2016-04-09T14:35:13.533

Interesting approach! – Conor O'Brien – 2016-04-09T15:38:29.347

2

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@^^`

PhiNotPi

Posted 2016-04-09T00:54:10.967

Reputation: 26 739

Show one more byte. – Leaky Nun – 2016-04-09T03:02:39.667

@KennyLau I thought it was 1 out of 5? It's 10 bytes and I'm showing 3. – PhiNotPi – 2016-04-09T03:03:48.087

Inputs and outputs don't count, so you have 8 bytes and you showed 1. – Leaky Nun – 2016-04-09T03:07:41.797

@KennyLau done. – PhiNotPi – 2016-04-09T03:09:47.450

Cracked. – Leaky Nun – 2016-04-09T03:20:26.850

@KennyLau nice. (and slightly different than original) – PhiNotPi – 2016-04-09T03:24:37.610

2

Pyth, 18 bytes

# marks unrevealed characters.

L?Jtb##5#m##S#2 #y

Outputs (starts from 1):

1 -> 2
2 -> 3
3 -> 5
4 -> 7

Online interpreter

Leaky Nun

Posted 2016-04-09T00:54:10.967

Reputation: 45 011

Primes, no? If not... – Blue – 2016-04-09T12:45:01.597

If not... what? – Leaky Nun – 2016-04-09T12:47:39.680

then I have no idea – Blue – 2016-04-09T12:47:57.987

2

05AB1E, 5 bytes, cracked

I hope that this submission isn't as easy as my other ones :p. Outputs:

a(0) = 0
a(1) = 1
a(2) = 6
a(3) = 24
a(4) = 80
a(5) = 240

Obfuscated code:

####O

Contains some non-ASCII characters though, uses CP-1252 encoding.

Try it online! might come in handy :p.

Adnan

Posted 2016-04-09T00:54:10.967

Reputation: 41 965

Cracked. – LegionMammal978 – 2016-04-09T15:12:16.607

Why do I feel like I've seen it before? – Leaky Nun – 2016-04-09T16:14:57.917

@KennyLau ¯\(ツ) – Adnan – 2016-04-09T16:18:50.470

2

JavaScript ES6, 119 bytes, Cracked.

Output:

a(0) = 0
a(5) = 10000

Code:

x=>##=#=>[[[##x####r(###f#n###;#####n####h.##w###<1##].c####t.##pl##[####nc#######y([###(###(#]###)######`#######h####`

Returns an anonymous function.

Original sequence: A016744.

Original code:

x=>{f=n=>[[[1,x] for(x of n)]];return Math.pow(x<<1,[].concat.apply([].concat.apply([],f(f(f([]))))).join``.length)}//`

I need to show more characters of obsfucated code next time :P

Conor O'Brien

Posted 2016-04-09T00:54:10.967

Reputation: 36 228

Cracked. I wasn't sure which sequence you were going for though, so I had to just choose the easiest one then ignore the rest of the characters. :( – user81655 – 2016-04-10T06:52:21.490

2

Jolf, 13 bytes, safe!

Outputs:

a(5) = 40
a(8) = 128

Code:

#+~##~####xx#

Interpreter.

Revealed:

OEIS A003600

γ+~iu~iZCzxxγ
γ γ =
zx range 1..x (input)
ZC cumulutive sum
~i identity
u sum of
~i identity
+ x plus x
γ out γ

Conor O'Brien

Posted 2016-04-09T00:54:10.967

Reputation: 36 228

Ooh, Jolf. I'm gonna have a crack at this one. Please don't steal it, Kenny. – Fund Monica's Lawsuit – 2016-04-10T04:04:15.763

@QPaysTaxes Any luck? :3 – Conor O'Brien – 2016-04-10T15:37:42.240

I might've had some of you didn't have undocumented functions everywhere :P. As it is, I've got two candidates for the sequence, and some idea of how to make them, but it's a pain in the butt :P – Fund Monica's Lawsuit – 2016-04-10T16:36:22.267

@QPaysTaxes I don't think this code uses any undocumented features. – Conor O'Brien – 2016-04-10T16:37:28.407

But they still make reading the source hard. Anyway, I'm just complaining. Feel free to ignore me. – Fund Monica's Lawsuit – 2016-04-10T16:38:23.780

@QPaysTaxes Consider yourself ignored ;) – Conor O'Brien – 2016-04-10T16:38:38.703

2

Pyke, 6 bytes, Cracked

###X#s

Output:

a(2) = 8
a(8) = 80
a(10) = 120

This doesn't work with N<1

Original solution:

hSmX$s

Blue

Posted 2016-04-09T00:54:10.967

Reputation: 26 661

Welp, I found an easier alternate to what I had – Blue – 2016-04-09T19:12:03.163

Cracked. – LegionMammal978 – 2016-04-09T19:19:05.870

2

Jolf, 16 bytes, safe!

Outputs:

a(0) = 0
a(4) = -2
a(51) = 26

Code:

#.‘###4#x##32#mA

Revealed:

Sequence: A001057, the canonical enumeration of integers.
*.‘01m4zx’m32xmA
‘ ’ an array
0 0: 0
1 1: 1
m4zx antisum of range 1..x (1 - 2 - 3 - 4 - ... - x)
. m32x get min(2, x) of that array
* mA multiply that entry by the sign of x (implicit input); is zero when zero

Conor O'Brien

Posted 2016-04-09T00:54:10.967

Reputation: 36 228

2

05AB1E, 5 bytes, cracked

##s##

# indicates a hidden character.

Output:

a(4) = 8
a(6) = 144

The sequence starts at a(1).


The original code was exactly as in @Adnan's answer to robbers' thread.

Luis Mendo

Posted 2016-04-09T00:54:10.967

Reputation: 87 464

2My first 05AB1E submission! – Luis Mendo – 2016-04-10T03:26:33.983

1Wow! I'm glad to see this :) – Adnan – 2016-04-10T08:22:29.807

1Cracked. – Adnan – 2016-04-10T08:48:18.873

@Adnan I thought it would last longer :-) Can sequences in OEIS be searched for specific terms? – Luis Mendo – 2016-04-10T11:38:11.277

@Adnan, Oh, there is. _ is used for missing terms – Luis Mendo – 2016-04-10T12:03:37.123

Yes, although OEIS searches for the terms regardless of the starting position of a sequence. I made a script which also searches for the same starting index, so it would rule out other sequences. – Adnan – 2016-04-10T12:20:27.997

@Adnan Could you share it ? – FliiFe – 2016-04-11T09:18:08.877

@FliiFe Probably gonna violate the copyright law, but here you go.

– Adnan – 2016-04-11T11:07:30.670

1

@Adnan I think you could avoid copyright law infringement by first making a first search on oeis (preformated), and then let the script choose which one respects the indexes

– FliiFe – 2016-04-11T12:18:43.890

@FliiFe Oh, that might be a better idea – Adnan – 2016-04-11T14:12:06.700

2

J, 8 bytes, cracked

# marks unrevealed characters

(##-#)#.

(Online interpreter here.)

Output:

No, I'm not hiding anything by using a long sample. If the input is 0, it outputs 0, if the input is between 1 and 29, it outputs 1.

The outputs for the negative inputs do not match with the actual sequence.

   (##-#)#.0
0
   (##-#)#.1
1
   (##-#)#.2
1
   (##-#)#.3
1
   (##-#)#.4
1
   (##-#)#.5
1
   (##-#)#.6
1
   (##-#)#.7
1
   (##-#)#.8
1
   (##-#)#.9
1
   (##-#)#.10
1
   (##-#)#.11
1
   (##-#)#.12
1
   (##-#)#.13
1
   (##-#)#.14
1
   (##-#)#.15
1
   (##-#)#.16
1
   (##-#)#.17
1
   (##-#)#.18
1
   (##-#)#.19
1
   (##-#)#.20
1
   (##-#)#.21
1
   (##-#)#.22
1
   (##-#)#.23
1
   (##-#)#.24
1
   (##-#)#.25
1
   (##-#)#.26
1
   (##-#)#.27
1
   (##-#)#.28
1
   (##-#)#.29
1

Leaky Nun

Posted 2016-04-09T00:54:10.967

Reputation: 45 011

Cracked. – jimmy23013 – 2016-04-10T09:43:31.530

2

05AB1E, 28 bytes (Cracked)

#D>D>D>D>*##*#D<*#+*#n#n#**#

a(1) = 1

a(2) = 8

a(3) = 42

Behaviour for zero is unspecified.

Cracked:

 DD>D>D>D>****rD<*6+*6n2n5**/

There is no need for an explanation I think as the crack was almost 100% spot on. The only difference is I used r to reverse stack instead of swapping top two elements.

Lause

Posted 2016-04-09T00:54:10.967

Reputation: 231

Cracked – Emigna – 2016-04-14T12:38:02.307

2

05AB1E, 10 bytes, Cracked

##3##1+*1+

0-indexed.

0 ==> 1
4 ==> 61
5 ==> 91
9 ==> 271

Original Program:

UX3*X1+*1+

George Gibson

Posted 2016-04-09T00:54:10.967

Reputation: 2 369

2Cracked – Emigna – 2016-05-15T08:41:48.827

2

S.I.L.O.S, 37 bytes (Cracked.)

Code:

readIO
#=#
#+#
#*#
#*#
#+#
printInt i

#s are the hidden characters.

Output:

a(0) = 1
a(4) = 41
a(9) = 181

betseg

Posted 2016-04-09T00:54:10.967

Reputation: 8 493

1Cracked – Emigna – 2016-10-20T09:18:50.477

1

J, 7 bytes, cracked

Output:

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

Code (I have shown more for added difficulty):

#+#:###

Is a tacit verb.

Conor O'Brien

Posted 2016-04-09T00:54:10.967

Reputation: 36 228

Cracked. – Dennis – 2016-04-09T02:57:25.047

1

Python 2, 87 bytes, cracked

n=input()
#####################################################################
print _

Output:

a(5) = 2
a(10) = 2
a(15) = 1
a(20) = 1
a(25) = 1

I really should have checked for other sequences before I posted, here's another one that works (A014709):

n=input()
g=lambda n:~n%2*(n/2%2+1)or g(n/2);_=g(n)############################
print _

Sp3000

Posted 2016-04-09T00:54:10.967

Reputation: 58 729

Cracked. – LegionMammal978 – 2016-04-09T11:47:48.957

1

Jolf, 3 bytes Cracked, A001477

___

Examples:

0 -> 0

1 -> 1

4 -> 4

9 -> 9

Original Code:

 "%"

Rɪᴋᴇʀ

Posted 2016-04-09T00:54:10.967

Reputation: 7 410

Cracked. – LegionMammal978 – 2016-04-09T20:56:18.120

1

PHP, 18 bytes, cracked

Here's a very short one, at least in terms of PHP. I wonder if it survives this Sunday the next thirty minutes.

Output

a(0) = -1
a(1) =  0

Source

____$____[1]+_+_0;
#### ####    # #

Notes


Cracked

The sequence was A023443:

a(n) = n - 1

Here's my original source code, which is slightly different to the robber's:

echo$argv[1]+-+!0;

insertusernamehere

Posted 2016-04-09T00:54:10.967

Reputation: 4 551

1Cracked. – jimmy23013 – 2016-04-10T09:10:42.277

1

J, 8 bytes (Cracked)

# marks unrevealed characters

(#1-#)#.

The output:

No, I'm not hiding anything by using a long sample. If the input is 0, it outputs 0, if the input is between 1 and 29, it outputs 1.

The outputs for the negative inputs do not match with the actual sequence.

   (#1-#)#.0
0
   (#1-#)#.1
1
   (#1-#)#.2
1
   (#1-#)#.3
1
   (#1-#)#.4
1
   (#1-#)#.5
1
   (#1-#)#.6
1
   (#1-#)#.7
1
   (#1-#)#.8
1
   (#1-#)#.9
1
   (#1-#)#.10
1
   (#1-#)#.11
1
   (#1-#)#.12
1
   (#1-#)#.13
1
   (#1-#)#.14
1
   (#1-#)#.15
1
   (#1-#)#.16
1
   (#1-#)#.17
1
   (#1-#)#.18
1
   (#1-#)#.19
1
   (#1-#)#.20
1
   (#1-#)#.21
1
   (#1-#)#.22
1
   (#1-#)#.23
1
   (#1-#)#.24
1
   (#1-#)#.25
1
   (#1-#)#.26
1
   (#1-#)#.27
1
   (#1-#)#.28
1
   (#1-#)#.29
1

Leaky Nun

Posted 2016-04-09T00:54:10.967

Reputation: 45 011

Are you sure it's a function, so ((#1-#)#.)1 also works? – jimmy23013 – 2016-04-10T09:58:30.373

((#1-#)#.)1 works. – Leaky Nun – 2016-04-10T10:09:38.323

Cracked. – Zgarb – 2016-04-10T20:39:10.780

1

PHP, 137 bytes, cracked

This is my final sequence. You should be feeling lucky when trying this one.

Output

a(3)  =   7
a(7)  =  21
a(23) =  99

Source

for(___range___303_______________________array_merge____)for(__________________________________________)unset________;echo___$argv[1]-1_;
    ###     ###   #######################           ####     ##########################################      ########     ###          #

Notes

  • This sequence starts at 1.
  • The program works up to the last number given bei OEIS, but can easily be adjusted to go to any other value as well.
  • It's a full program, not a function.
  • Reads the input from command line (obviously).
  • Does not contain any PHP opening tag.

Cracked

The wording "feeling lucky" and the value 303 in the source were hints to the sequence A000959:

Lucky numbers

This is my original source, which is slightly different to the robber's:

for($n=range(1,303);$j<count($n);++$j,$n=array_merge($n))for($i=($x=$j?$n[$j]:2)-1;isset($n[$i]);$i+=$x)unset($n[$i]);echo$n[$argv[1]-1];

insertusernamehere

Posted 2016-04-09T00:54:10.967

Reputation: 4 551

1Cracked. – jimmy23013 – 2016-04-11T00:54:22.193

1

MATL, 10 bytes, safe!

2*##n##qn-

Starts at 1, # are hidden characters. Sample input/output:

a(3)=1
a(8)=2

Revealed

The sequence is the number of primes between n and 2*n. The code used was 2*ZqnGZqn-. This takes implicit input, doubles it, and finds the number of primes less than that number, pushes the input again and finds the number of primes less than that, and then subtracts the two lengths from each other.

David

Posted 2016-04-09T00:54:10.967

Reputation: 1 316

I was close with 2*_VnGYqn- (number of decimal figures in 2*input). But that doesn't seem to be an OEIS sequence – Luis Mendo – 2016-04-17T23:36:48.820

I'm really surprised you haven't got it! I wan't thinking of anything like that sequence though. The G is correct though..... – David – 2016-04-17T23:40:49.013

1

Seriously, 14 bytes (Safe)

,???D*≈@??D*≈-

The ?s denote the hidden code. This sequence starts at a(0).

Output:

a(0) = 1
a(1) = 0
a(3) = 1

Solution:

The sequence is:

A005614 (the infinite Fibonacci word)

My solution:

,;uφD*≈@⌐φD*≈-

The solution is a straightforward implementation of the formula found on the OEIS page (with an error corrected so that the sequence starts at n=0 like the page shows, rather than n=1).

Mego

Posted 2016-04-09T00:54:10.967

Reputation: 32 998

I'm assuming your sequence starts at 0. – Fund Monica's Lawsuit – 2016-04-11T04:38:46.883

@QPaysTaxes Given that the first sample output is a(0), that's a safe assumption :) – Mego – 2016-04-11T04:43:38.093

No, I mean that either a(-1) is undefined or not listed on OEIS. – Fund Monica's Lawsuit – 2016-04-11T04:44:11.640

@QPaysTaxes You are correct. – Mego – 2016-04-11T04:50:44.320

1

Pyth, 51 bytes, Safe

# denote hidden characters:

K"#"D#d=#:d"#|#"1Rs#?qd"#"####"##"b#W<#K+#1=KhK;@KQ

K"0"Dhd=b:d"0|1"1Rsm?qd"0""01""10"b;W<lK+Q1=KhK;@KQ

Outputs

a(0) -> 0
a(1) -> 1
a(2) -> 1
a(4) -> 0

This is a fair one.

Thue-morse sequence, A010060.

FliiFe

Posted 2016-04-09T00:54:10.967

Reputation: 543

1

C++, 55 bytes (Safe)

This one should be easy...

source:

bool f(int###########;##r#;r###&1#####+######r######r;}

Output:

f(1)=>0
f(2)=>1
f(3)=>1
f(4)=>0
f(5)=>1
f(6)=>0
f(7)=>1
f(8)=>0
f(9)=>0
f(10)=>0
f(11)=>1

answer

Sequence:

A010051 (Characteristic function of primes: 1 if n is prime else 0.)

code:

bool f(int r){int i=2;for(;r%i&&1-r;i++);return i ==r;}

MegaTom

Posted 2016-04-09T00:54:10.967

Reputation: 3 787

I am curious, what is the solution? – mIllIbyte – 2016-04-20T07:52:45.177

@mIllIbyte my solution is posted – MegaTom – 2016-04-20T13:51:26.303

No obscure language features at all, it's just optimized. Neat! – mIllIbyte – 2016-04-21T15:15:39.620

1

Haskell, 51 bytes (Cracked)

Outputs:

f 0 -> 0
f 1 -> 1
f 2 -> 1
f 3 -> 0
f 4 -> 0
f 5 -> 3
f 6 -> 5

Code:

f e=sum[#########$#####(f######=#####e####)#######]

This defines a function named f, with # as the wildcard character. Shouldn't bee too hard to crack.

Zgarb

Posted 2016-04-09T00:54:10.967

Reputation: 39 083

my guess – nimi – 2016-04-11T23:37:34.843

@nimi That is exactly identical to my reference answer. I'll edit it here later. – Zgarb – 2016-04-13T02:03:46.460

1

Ruby, 11 bytes, cracked

Code:

->i{######}

Output:

f(0) = 0
f(1) = 0
f(2) = 0
f(3) = 1
f(4) = 0
f(5) = 0
f(6) = 0
f(7) = 1
f(8) = 0
f(9) = 0
f(10) = 0
f(11) = 1
f(12) = 0
f(13) = 0
f(14) = 0
f(15) = 1

And so on, forming A011765. Curious to see if there's more than one way to do this in 6 bytes.

histocrat

Posted 2016-04-09T00:54:10.967

Reputation: 20 600

Cracked? – Martin Ender – 2016-04-11T20:13:35.323

What was the intended solution then? :) – Martin Ender – 2016-04-11T20:27:19.193

Was being cagey since there might be a way to salvage the trick, but I've added it to the solution thread. – histocrat – 2016-04-11T20:29:47.267

Here it is in 6 bytes in bc: !++x%4 – None – 2016-04-18T01:53:50.810

1

Python, 123 bytes, Cracked

Probably not winning any prizes, but fun nonetheless.

# marks a hidden character, it is not used anywhere in the code.

def #(#):
 if n<2:
  return n
 else:
  return #(n-1)+#(n-2)

def g(n):
 ######:
  return n
 else:
  return (#(n##)+#(##2))###

Sample cases:

g(1) -> 1
g(6) -> 8
g(10) -> 7

My sequence was A089911, Fibonacci Numbers mod 12.

Original code:

def f(n):
 if n<2:
  return n
 else:
  return f(n-1)+f(n-2)

def g(n):
 if n<2:
  return n
 else:
  return (f(n-1)+f(n-2))%12

ASCIIThenANSI

Posted 2016-04-09T00:54:10.967

Reputation: 1 935

Cracked. – Adnan – 2016-04-12T12:02:09.377

1

Javascript, 30 bytes, Cracked

# marks unrevealed characters.

n=>M###.##w(n#!#[#+!#[#)-(n##)

Examples:

0 -> 1
1 -> 1
7 -> 43
18 -> 307

Original Code:

n=>Math.pow(n,!+[]+!+[])-(n-1)

Aplet123

Posted 2016-04-09T00:54:10.967

Reputation: 355

Cracked – insertusernamehere – 2016-04-12T08:41:59.283

1

Python, 17 bytes, Cracked

####a(n):########

Test cases:

a(1) -> 1
a(2) -> 2

ASCIIThenANSI

Posted 2016-04-09T00:54:10.967

Reputation: 1 935

Cracked – Blue – 2016-04-12T17:40:41.530

1

Python, 60 bytes, Cracked

def a(n):
 if n<#: 
  return #
 else:
  return a(n-#)+a(n-#)

Test cases:

a(0) -> 1
a(1) -> 1
a(3) -> 2
a(6) -> 6

ASCIIThenANSI

Posted 2016-04-09T00:54:10.967

Reputation: 1 935

Cracked – Blue – 2016-04-12T17:46:20.720

1

Seriously, 16 bytes (safe)

???"Xi"?≈$?,?R??

Examples:

a(3) = 1
a(40) = 4

This sequence starts at a(1).


Sequence:

http://oeis.org/A001222 (prime divisors of n with multiplicity)

Code:

ΣM£"Xi"w≈$X,QR£ƒ

Explanation:

The neat thing about this code (and the reason why it's difficult to crack) is that the actual divisor-counting part is reversed. Going through the code, everything up until the , doesn't actually do anything when executed left-to-right (except for pushing "Xi" and then subsequently popping it). ,QR£ƒ reads in the input (n) and executes the code reversed (Q pushes the source code, R reverses it, and £ƒ calls it). Now, the stack contains n and the code is ƒ£RQ,X$≈w"iX"£MΣ. The first 3 commands (ƒ£R) do nothing with an integer on the stack. Q pushes the source code (again), , does nothing because the input is exhausted, and X gets rid of the Q result. $≈ converts the input to a string and back to an int (necessary in the reversed code to prevent unwanted stack items). w pushes a list of [prime, exponent] pairs for all the prime factors of n, and iX"£MΣ sums up all of the exponents.

Mego

Posted 2016-04-09T00:54:10.967

Reputation: 32 998

1

R 64 bytes

Code

##########################
a=function(x)sum(x*3,1,a(x-2):a(x-1))

Output

a(1) =1
a(2) =1
a(3) =2
a(4) =3
a(5) =5
a(6) =8
a(7) =13
a(8) =21
a(9) =34
a(10)=55
a(11)=89
a(12)=144
a(13)=233
a(14)=377
a(15)=610
a(16)=987
a(17)=1597
a(18)=2584
a(19)=4181
a(20)=6765

Simply, Fibonnaci sequence.

Hope it's fun enough.

Masclins

Posted 2016-04-09T00:54:10.967

Reputation: 914

1

Jolf, 3 bytes, cracked

Output:

a(0)  =      0
a(4)  =    260
a(10) =  10010
a(23) = 279864

Code:

###

All these features are documented. Yeah, you don't get any parts of the code :P The sequence is off-by-one.

Original:

+ΤQ

Conor O'Brien

Posted 2016-04-09T00:54:10.967

Reputation: 36 228

Cracked. – Martin Ender – 2016-04-17T20:46:22.980

Ah, I thought you might be using T because you added it to the docs just before you posted the answer, but I didn't consider combining it with Q. – Martin Ender – 2016-04-17T21:09:33.150

@MartinBüttner Was it that obvious? XD Nice job, anyhow! Thanks for using Jolf! :D – Conor O'Brien – 2016-04-17T21:10:42.323

1

05AB1E, 4 bytes, cracked

Outputs:

a(0) = 1
a(2) = 4
a(10) = 4444

Code:

____

_ indicates an obfuscated character. Try it online!.

Adnan

Posted 2016-04-09T00:54:10.967

Reputation: 41 965

Easy to find. Easy to implement. Hard to optimize to 4 bytes (stuck at 6 atm). Nice challenge! – Emigna – 2016-04-20T11:34:17.570

@Emigna Yeah, that's probably going to be the hardest part. I think I know what your current 6 byte solution is, so my tip is that there are 1 byte commands which can replace 2-byte combinations in your code (and there are two of them). Good luck though :) – Adnan – 2016-04-20T20:22:29.627

Cracked I never understood was  did when I read the spec. Should have just looked at the code. Pretty sure I tried F earlier, but I must have done something wrong. My favorite cop this far :) – Emigna – 2016-04-21T09:03:57.467

@Emigna Yeah, I might have to make the docs a bit more specific. Great job in cracking though :). – Adnan – 2016-04-21T19:02:04.277

1

05AB1E, 3 bytes, Cracked

Output:

a(4) = 4
a(6) = 7

Code:

___

_ (underscore) indicates an obfuscated character

Try it online

Emigna

Posted 2016-04-09T00:54:10.967

Reputation: 50 798

Cracked :) – Adnan – 2016-04-25T18:06:48.233

@Adnan: Oh come on! Not even 1h :) – Emigna – 2016-04-25T18:12:07.363

Hahaha, sorry. I always get excited when I see someone else post in 05AB1E :). – Adnan – 2016-04-25T18:16:08.947

1

05AB1E, 8 bytes, Cracked

Output:

a(3) = 2
a(4) = 7

Code:

___s_r__

_ (underscore) indicates an obfuscated character

Try it online

Original Code:

ÑDgs`rG^

Which is the sequence A178910 (Binary XOR of divisors of n.)

Emigna

Posted 2016-04-09T00:54:10.967

Reputation: 50 798

Cracked. – Adnan – 2016-04-28T23:09:10.973

1

05AB1E, 3 bytes, Cracked

Output:

a(3) = 2
a(4) = 6

Code:

___

_ (underscore) indicates an obfuscated character

Try it online

Original Code:

D;^

Which is the sequence A003188 (Decimal equivalent of Gray code for n)

Emigna

Posted 2016-04-09T00:54:10.967

Reputation: 50 798

Cracked. That was a nice puzzle! :) – Adnan – 2016-04-28T22:54:35.117

1

LiveCode, 35 bytes, cracked

_un_t_on oeis _
    ___u___n__
En__oeis

oeis (2)==2

oeis (0)==0

penalosa

Posted 2016-04-09T00:54:10.967

Reputation: 505

Cracked – Emigna – 2016-04-27T06:24:08.530

1

Python, 37 bytes, cracked

def a(n):
    return ______!______n____*_

a(2)==4 a(4)==16

penalosa

Posted 2016-04-09T00:54:10.967

Reputation: 505

Cracked – Emigna – 2016-04-27T07:13:02.020

1

Python 3, 58 Bytes, Cracked

# marks unrevealed chars.

import math;x=int(input());print(int(x/math.####(#)*#**#))

If x < 1, it will not work.

in    out
1     0
4     457
7     2578097
10    44721359549
13    1760848250285208
16    131994155879539032064
19    16810747184697114703691776

Mega Man

Posted 2016-04-09T00:54:10.967

Reputation: 1 379

Cracked. – Zach Gates – 2016-05-01T18:13:25.940

1

Jelly, 5 bytes (safe)

Code

??Œ??

Each ? denotes a missing character.

Output

n a(n)

0    1
1    3
2    9
3   21
4   45
5   93
6  189
7  381
8  765
9 1533

This is OEIS entry A068156.

Solution

Ḷ¡ŒṘL

Try it online!

How it works

As noted on the OEIS page, this sequence obeys the recursive formula a(n + 1) = 2a(n) + 3, with base cases a(0) = 1, a(1) = 3.

The code begins with the integer n and applies (unlength) n times, which convert all integers k in the previous array into the range [0, ... k - 1]. The output after all n steps is similar to the set-theoretic definition of n.

For n = 0, 1, 2, 3, 4, the outputs of Ḷ¡ŒṘ (unlength n times, then generate Python's string representation) is as follows.

0: 0
1: [0]
2: [[], [0]]
3: [[], [[]], [[], [0]]]
4: [[], [[]], [[], [[]]], [[], [[]], [[], [0]]]]

If we examine the outputs for 3 and 4 closely, we can note the following pattern.

[[], [[]], [[], [0]]]XX[[], [[]], [[], [0]]]X
[[], [[]], [[], [[]]], [[], [[]], [[], [0]]]]

The output for 4 consists of two copies of the output for 3 (the actual characters differ, but we're only interested in the length), and three additional characters (X marks the spots). Thus, if we take the length with L, our program follows the desired recursive formula.

Dennis

Posted 2016-04-09T00:54:10.967

Reputation: 196 637

0

Python 3, 108 bytes (Cracked)

Warning (and hint): my implementation is dreadfully slow...

>>> a(0)
0
>>> a(4)
2
>>> a(16)
8
>>> a(20)
42

a(0) is the first element of the series exactly as defined in OEIS. # is used to hide chars.

def a(n):
 ###n####0######n#0
 f=a#######
 return f #f#####a###### f ####a(##f###i#i###a####n##else a#######

CAD97

Posted 2016-04-09T00:54:10.967

Reputation: 1 367

Cracked – FliiFe – 2016-04-10T20:58:03.813

0

Python 3, 50 bytes (Cracked)

Another one, because I like this sequence

>>> a(1)
0
>>> a(10)
2303

The first number from the sequence is a(0). # used to obfuscate characters.

from #### import ####
a=lambda n:####(###########)

CAD97

Posted 2016-04-09T00:54:10.967

Reputation: 1 367

Cracked – Mego – 2016-04-11T01:44:18.543

0

Python 3, 58 bytes (Cracked)

One last series

>>> a(0)
0
>>> a(4)
8
>>> a(5)
17

Sequence starts with a(0).

a=lambda n:###(###(###)## if ###### else #####(#######)##)

Original was different than the cracked, because I can't golf Python :P

a=lambda n:int(3**(n/2)-1 if n%2==0 else 2*3**(n/2-1/2)-1)

CAD97

Posted 2016-04-09T00:54:10.967

Reputation: 1 367

Cracked. – feersum – 2016-04-11T03:40:14.817

0

Python 2, 72 bytes, cracked

print####((#y##########.####c###6#####16#.######)#131963###input()#3###)

Outputs:

a(1) = 1
a(2) = 2
a(3) = 3
a(4) = 6
a(5) = 9
a(6) = 18

a(1) is the first element of the sequence. Tested on my personal computer, on repl.it and on ideone (which have versions 2.7.11, 2.7.2 and 2.7.10 respectively).


The sequence is finite, and all terms are listed - it's just the divisors of 18. However, I overlooked the idea that #s could be substituted for newlines...

The original one-liner was:

print len((BytesWarning.__doc__*6)[8::16].split()[1319648>>input()*3&7])

Sp3000

Posted 2016-04-09T00:54:10.967

Reputation: 58 729

Cracked. – feersum – 2016-04-11T18:12:59.767

0

Pyth, 4 bytes, Cracked

# denote hidden characters:

###Q

Output

a(1) -> 1
a(2) -> 2
a(3) -> 3
a(10) -> 42

FliiFe

Posted 2016-04-09T00:54:10.967

Reputation: 543

Is this offset at all? – Blue – 2016-04-11T17:22:33.670

@muddyfish ... I posted this answer without double-checking. I updated the examples. – FliiFe – 2016-04-11T17:30:45.483

@muddyfish To answer your question, a(0) is the first term of the sequence. I'm not sure if that's what you wanted to know, but at least you know that. – FliiFe – 2016-04-11T17:32:15.093

Cracked. – Adnan – 2016-04-11T18:31:40.427

0

Pyth, 29 bytes

W##YQ#t^#Z=#h#I#_#=#+Y##;@#tQ

Probably not an easy one. Begins at 1.

a(1) -> 2
a(2) -> 3
a(3) -> 5
a(4) -> 7
a(5) -> 13

FliiFe

Posted 2016-04-09T00:54:10.967

Reputation: 543

0

Molecule (v5.5), 25 bytes (UTF-8)

"ᘰᜟᘄఄሳÝ̲"C`n

No characters are hidden here ;)
An input of 0 is allowed.

Output of 1: 16
Output of 2: 21

user47018

Posted 2016-04-09T00:54:10.967

Reputation:

You need to hide some characters to make it a valid submission – TuxCrafting – 2016-10-22T21:37:07.083

The worst thing: It's safe xD – TuxCrafting – 2016-10-22T21:37:20.317

0

Python, 42 bytes Cracked

def f(x):return # if x<#else ######+######

Where

f(0) -> 0
f(1) -> 1
f(7) -> 13
f(15) -> 610

TuxCrafting

Posted 2016-04-09T00:54:10.967

Reputation: 4 547

Cracked. – Dennis – 2016-10-04T15:40:35.097

0

PHP, 118 Bytes, Safe

I hope that I'm understand the rules right

function f($n){for($a=[],$i=0,$n++;$n!=@@@@@@($a);$i++)if(@@@@@@@)if(@@@@@@@@(@@@@@@@@@@@@@@))$a[]=$i;return end($a);}

echo f(6); # 16
echo f(13);# 32
echo f(0); #2
echo f(1); #4
echo f(54); #128

Original code

function f($n){
  for($a=[],$i=0,$n++;$n!=sizeof($a);$i++){
      if($t=$i%7)if(in_array($t,array(2,4,6)))$a[]=$i;
  } 
  return end($a);
}

generates this sequence

Jörg Hülsermann

Posted 2016-04-09T00:54:10.967

Reputation: 13 026