33
\$\begingroup\$

Robber's thread

Your task as cops is to select three things:

  • A programming language

  • An OEIS sequence

  • A byte set

You are then to secretly write a program in that language that computes the nth term sequence using only the bytes in the set. You will reveal the three pieces of information so that robbers can try to figure out the program.

Answers will be scored by the number of bytes in the byte set with more score being good. Cracked answers have an automatic score of 0. If your answer is uncracked after one week you may reveal the intended program and mark your answer as "safe".

Answers must be capable of calculating every term in the b-files of the sequence, but are not required to calculate any terms after.

Sequences can be either 1 or 0 indexed for both cops and robbers.

Here is a Python Script that checks if your code matches the given byte set.

\$\endgroup\$
16
  • 1
    \$\begingroup\$ Lower score is better? Or higher? So in essence we're trying to find a restricted character set that makes it difficult for someone else to make a program in the chosen language, after we've already worked out a solution? \$\endgroup\$
    – BradC
    Commented Jul 27, 2017 at 16:56
  • 1
    \$\begingroup\$ Do we need to use all the bytes in our set? I would guess yes but it should probably be specified in the challenge. \$\endgroup\$
    – Shaggy
    Commented Jul 27, 2017 at 17:06
  • 1
    \$\begingroup\$ @Shaggy generally no, you can includes others for red herrings, but robbers can use everything \$\endgroup\$
    – Stephen
    Commented Jul 27, 2017 at 17:08
  • 1
    \$\begingroup\$ Can robbers use the same byte twice or more? \$\endgroup\$
    – Mr. Xcoder
    Commented Jul 27, 2017 at 17:19
  • 2
    \$\begingroup\$ @Azulflame The b-files are files that are associated with each sequence the can be accessed by replacing the A with a b and appending a .txt. For example oeis.org/b4.txt would access the b-files for that sequence. \$\endgroup\$
    – Wheat Wizard
    Commented Jul 27, 2017 at 23:47

72 Answers 72

2
\$\begingroup\$

C, A027868 (Cracked)

I don't expect this to last too long...

Byte set: int (){reu<5?-:/;}

\$\endgroup\$
1
2
\$\begingroup\$

R, A057077, (cracked)

1, 1, -1, -1, 1, 1, -1, -1, etc

Byte set:

()*/=2abcinopst

0-indexed.

\$\endgroup\$
1
2
\$\begingroup\$

JavaScript (ES6), A000035, cracked

A000035 is n mod 2, in case the site goes down or you're too lazy to check yourself. Charset:

023456789\`efu

Taking the "somehow still Turing-complete" route. I suppose I could've added 51 or so non-ASCII chars to improve my score, but that feels kind of like cheating.

Takes input through prompt and outputs through alert, and can be run in any modern browser.


Intended solution:

\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e`\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0028\u0046\u0075\u006e\u0063\u0074\u0069\u006f\u006e\u0028\u0022\u0072\u0065\u0074\u0075\u0072\u006e\u0028\u0034\u0038\u0032\u002f\u0032\u0029\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0032\u0032\u0029\\u002\u0062\u0027\u0065\u0072\u0074\u0028\u0070\u0072\u006f\\u006\u0064\u0070\u0074\u0028\u0029\u0025\u0032\u0029\u0027\u0022\u0029\u0028\u0029\u0029\u0028\u0029```

which, when the escapes are removed, translates to

Function`Function(Function("return(482/2).toString(22)\u002b'ert(pro\u006dpt()%2)'")())()```

which simplifies again to

Function`Function(Function("return(482/2).toString(22)+'ert(prompt()%2)'")())()```

This works because JavaScript allows \uXXXX escapes in variable names (though not in arbitrary code, as Java does). The outer Function`code``` is necessary to run the code at all, since the entire thing needs to be escaped.

(If you're confused about how this works: JavaScript has something called tagged template literals, which for our purposes is just a function call on a string; it just uses f`string` instead of f("code"). So Function`code``` is about the same as Function("code")().)

Now, because of the lack of the hexadecimal chars 1abcd, we'll have to double-encode certain necessary characters such as the m in prompt(). So instead of \u006d, it becomes \\u006\u0064. But now we need to evaluate this as a string twice to make sure this gets fully decoded. (pro\u006dpt() would work just fine, but using \u002b as + would not.) This is what the second Function(code)() is for.

One further obstacle exists: there's no 1 in the charset, necessary to create an a from \u0061. So there's no way to generate an a by unescaping a string (I checked, the octal representation is \141). Instead, we can generate it with e.g. (20/2).toString(20). I went ahead and generated al in this manner because l would require double-escaping like m.

But the problem now is that the innermost Function call is now just generating a string. In order to actually execute it, we need to return it from the function and pass it to a third Function call. This we do, and finally our journey is complete.

*I am aware of using ${} within template literals, but those aren't in the charset, alright?

\$\endgroup\$
1
2
\$\begingroup\$

PowerShell, A000012, 19 bytes, SAFE


$.0=[]acefilnorstv

Includes a newline and 18 other bytes. Good luck.

Try it online!


Intended Solution:

$a=$a[0]
$error[0].invocationinfo.offsetinline

Try it online!

This sets $a to be the value of an uninitialized variable $a indexed at [0]. Since that won't work, you get an error stating the following:

Cannot index into a null array.
At line:1 char:1
+ $a=$a[0]
+ ~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

The second line then pulls the .InvocationInfo and .OffsetInLine (i.e., where the error occurred), which in this case is always 1, and hence the A000012 sequence.

\$\endgroup\$
2
\$\begingroup\$

CPython 3.6.2, A000002 (cracked)

I don't want anybody running out of single-character variables, so I'm giving you 70 pseudo-random characters courtesy of Latin-1.

·èõÉÀ]ýÜâô¾×l¡¿Ós¦Í½²uÊi´#¬©Åñ[);?ò
à¢ådêøóÎÐþÒÏ®,(Öß.=Õc_ö\§éºún$tÞb¨

This is evil. You can't make a for loop. You can't make a while loop. You can't even try to do anything, much less except. I have given a new line so that you can use more than one statement, but there aren't any spaces, tabs or even colons to let you use any sort of flow control. There are no numbers. There are no strings. There is nothing of any use.

You do have \ and #, though, so you can write clear code with soft breaks and comments.

That is, if you speak Jelly.

\$\endgroup\$
5
  • \$\begingroup\$ cracked with over 28kb of code \$\endgroup\$ Commented Aug 4, 2017 at 15:30
  • \$\begingroup\$ @ppperry Congratulations. It is possible to get much smaller than that, though. \$\endgroup\$
    – wizzwizz4
    Commented Aug 4, 2017 at 21:12
  • \$\begingroup\$ I knew I was posting an unnecessarily long crack, but cracked is cracked, and it's only one day away from being safe. \$\endgroup\$ Commented Aug 4, 2017 at 21:22
  • \$\begingroup\$ @ppperry Fair point. Nobody else is probably going to attempt it, so there's no point saying that it's suboptimal. \$\endgroup\$
    – wizzwizz4
    Commented Aug 5, 2017 at 8:52
  • \$\begingroup\$ @ppperry That's not supposed to be there... Oh well. \$\endgroup\$
    – wizzwizz4
    Commented Aug 5, 2017 at 13:49
2
\$\begingroup\$

Python 2, A000142, cracked

Probably not too difficult, but since I really enjoyed solving these I thought I'll be a cop for once. Here's the byteset (first one is a space):

 ()*-:=abcdfghijklmoqruwyzABCDEFGHIJKLMNOPQRSTUVWXYZ

Intended solution

LyricLy's solution is much cleaner, but here's the one I had in mind:

Basically it's the same but instead of using bool(r) for 1 I used (r-r)**(r-r): f = lambda r: (r==r-r or r==(r-r)**(r-r))*(r-r)**(r-r) or r*blam(r-(r-r)**(r-r))

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – LyricLy
    Commented Aug 6, 2017 at 10:32
2
\$\begingroup\$

Cubically, A016742 (Cracked)

This sequence is even square numbers: 0, 4, 16, 36, 64, ...

Byte set:

  • Any letter except [UuDdLlRrFfBb]
  • The digits [6789]
  • Any symbol except [-^:@/]
  • Anything not mentioned in the ASCII character set, including whitespace.

Try It Online!

\$\endgroup\$
5
  • \$\begingroup\$ You don't need to include that last note; languages (and language versions) made after the challenge are perfectly valid as of a new consensus. \$\endgroup\$
    – MD XF
    Commented Aug 2, 2017 at 2:09
  • \$\begingroup\$ @MDXF I wanted to specify which version to use. It was created before loops, but after input. Future language changes may warrant changes to the answer. \$\endgroup\$
    – TehPers
    Commented Aug 2, 2017 at 3:32
  • \$\begingroup\$ I suggest not changing the answer after this has already been posted. People may be working on a crack. \$\endgroup\$
    – MD XF
    Commented Aug 2, 2017 at 3:48
  • \$\begingroup\$ @MDXF I know, I won't. I was just saying why I specified the version. I guess if anyone wants to crack it with future language versions, they're welcome to. \$\endgroup\$
    – TehPers
    Commented Aug 2, 2017 at 4:04
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$ Commented Aug 7, 2017 at 13:31
2
\$\begingroup\$

Braingolf, A010701 Score: 9 [SAFE]

Byte set:

0x21, 0x24, 0x2F, 0x3A, 0x3F, 0x5B, 0x5D, 0x5F, 0x7C

Try it Online!

The code:

$_/[!?:]|[!?:]|

Try it online!

Explanation

$_/[!?:]|[!?:]|  Implicit input from commandline args
$_               Remove top of stack
  /              Niladic division, push 5
   [...]         While loop, decrements bottom of stack at start of loop
                 then decrements each time loop reaches end
                 Exits when bottom of stack is 0
    !?:.|        If conditional without popping, runs contained code if top of stack is 0
                 This is the sneaky trick here. The conditional skips the end of the loop
                 As a result, this whole block from [ to | effectively acts as a decrement.
         [!?:]|  We do this twice to lower the 5 we pushed down to 3
                 Implicit output of top of stack.
\$\endgroup\$
2
  • \$\begingroup\$ So, I was wondering why nobody had solved this yet, and I realised it relies on an undocumented feature of while loops. Whoops! Try experimenting around a little with while loops and conditionals, and you should find the answer fairly easily ;) \$\endgroup\$
    – Mayube
    Commented Jul 30, 2017 at 14:58
  • \$\begingroup\$ This is now safe. \$\endgroup\$
    – Oliver Ni
    Commented Aug 6, 2017 at 14:02
1
\$\begingroup\$

Python 3, A000002, Cracked with the intended solution

These are the bytes of a full program, 0-indexed solution for the Kolakoski sequence: OEIS A000002.

pg*rn:e+%2a tu]
(=foi[)1l,

This contains a space, a newline, and all the other characters in the snippet above. Hopefully this won't be too easy to crack :)

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Cracked! \$\endgroup\$
    – notjagan
    Commented Jul 27, 2017 at 18:14
1
\$\begingroup\$

Python 2, A000042, 11 Bytes (Cracked)

Byte set:

int(pru*1)'

Answer:

print '1'*input()

Note: This is my first ever answer on PPCG, and I may have made a mistake...

\$\endgroup\$
5
  • \$\begingroup\$ Cracked? This doesn't work for the 0 term, but it seems that this was the intended program. \$\endgroup\$
    – notjagan
    Commented Jul 27, 2017 at 18:37
  • \$\begingroup\$ @notjagan also what I just got - Bobawob, does yours work for 0? \$\endgroup\$
    – Stephen
    Commented Jul 27, 2017 at 18:37
  • \$\begingroup\$ Could it be 1 indexed instead? \$\endgroup\$
    – JAD
    Commented Jul 27, 2017 at 18:38
  • \$\begingroup\$ Yes, it was the intended program. Sorry, did I need to include the 0th term? Like I said, this is my first ever challenge. \$\endgroup\$ Commented Jul 27, 2017 at 18:39
  • \$\begingroup\$ @Bobawob just switch it to this sequence, which is the same just without a leading 0 \$\endgroup\$
    – Stephen
    Commented Jul 27, 2017 at 19:19
1
\$\begingroup\$

JavaScript (ES6), 4 bytes, A005408 (Cracked)

This should be an easy one. Odd numbers: a(n) = 2n+1

Byte set:

$+=>
\$\endgroup\$
1
  • 3
    \$\begingroup\$ Cracked! (I hope, it's my first Cops & Robbers answer) \$\endgroup\$
    – LarsW
    Commented Jul 27, 2017 at 22:02
1
\$\begingroup\$

Python 2, A001146, Cracked

Byte set:

print(2*u)
\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$
    – lynn
    Commented Jul 28, 2017 at 13:11
1
\$\begingroup\$

LOLCODE, A000290, Cracked

Byte set:

.12ABDEFGHIKLMNOPRSTUVXY

The byte set also includes space and newline.

HAS FUNZ!

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Are we allowed newlines? As far as the interpreter I'm using (your link), they are required to not get errors. \$\endgroup\$
    – Azulflame
    Commented Jul 28, 2017 at 15:12
  • \$\begingroup\$ Yes, there are newlines... Sorry! \$\endgroup\$ Commented Jul 28, 2017 at 15:16
  • \$\begingroup\$ Also 1.2 (or other HAI version) would be needed to run \$\endgroup\$
    – Azulflame
    Commented Jul 28, 2017 at 15:18
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Azulflame
    Commented Jul 28, 2017 at 15:28
1
\$\begingroup\$

CJam, A000142, 8 bytes, Cracked

Byteset: {}*+)%1\

\$\endgroup\$
1
1
\$\begingroup\$

Unreadable, A000027, 92 bytes, Cracked

Byte Set:

!"#%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Also add space and newline

\$\endgroup\$
8
  • \$\begingroup\$ Why not include all of the bytes for maximum score? There is no loss to adding more bytes if they can't be used. \$\endgroup\$
    – Wheat Wizard
    Commented Jul 28, 2017 at 13:52
  • \$\begingroup\$ There are no other bytes in unreadable that I used. I don't even think that there are other bytes in the language... Could I add all of ASCII even if my language doesn't use some of the characters? \$\endgroup\$ Commented Jul 28, 2017 at 13:55
  • \$\begingroup\$ Since Unreadable is encoded in ASCII you can and probably should use all the characters in ASCII. \$\endgroup\$
    – Wheat Wizard
    Commented Jul 28, 2017 at 14:21
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Azulflame
    Commented Jul 28, 2017 at 14:51
  • \$\begingroup\$ It's not cracked yet! You are forgetting that the first value in A000027 in 1, not 0. \$\endgroup\$ Commented Jul 28, 2017 at 14:52
1
\$\begingroup\$

Octave, A000045

This produces the Fibonacci numbers, OEIS A000045. There's both a space and a newline in there.

It's 0-indexed, so input 0 gives 0.


 ()-;=>cdefinotu
\$\endgroup\$
1
1
\$\begingroup\$

JavaScript, A000004 (Cracked)

Look from the other side

at~N+1

Step Hen's solution

~NaN+1

My solution #1

~1+1+1

#2

~~NaN

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Cracked (at least for Chrome console) \$\endgroup\$
    – Stephen
    Commented Jul 29, 2017 at 2:19
1
\$\begingroup\$

Python 2, A006577, Cracked

Byte set:

+s-t,n u
r)i1(d>]f[:e&

Shouldn't be too hard, but still fun.

EDIT: Cracked by @BruceForte. The crack looks just about identical to my crack, but here's mine for reference.

Try it Online

\$\endgroup\$
3
  • \$\begingroup\$ Did you mean to include a p, or was that intentionally left out? \$\endgroup\$
    – Azulflame
    Commented Jul 28, 2017 at 6:36
  • 1
    \$\begingroup\$ @Azulflame p isn't needed since it seems that printing is not required as long as the value is somehow returned. See here for a non-contested, and valid, crack. \$\endgroup\$ Commented Jul 28, 2017 at 11:25
  • \$\begingroup\$ Cracked. \$\endgroup\$ Commented Jul 29, 2017 at 1:17
1
\$\begingroup\$

dc, A028444 (cracked)

-?/*+23568dpr

There are no spaces in the byte set, but that’s not a big deal for dc.

Sequence is indexed at 0.

Note: Rado’s Sigma function grows faster than any computable function and is thus noncomputable!

Intended solution: ?dddddd***3*rdd**22*-rd*53*+r26*-8/p

\$\endgroup\$
1
1
\$\begingroup\$

Ly, A005150, Cracked

!$+-012<=>JS[]lnprsu

Well. Let's see how this plays out.

\$\endgroup\$
1
  • \$\begingroup\$ I wanted to continue working on it, but you added a -, therefore: cracked. Nice way to promote your language! \$\endgroup\$ Commented Jul 29, 2017 at 21:21
1
\$\begingroup\$

Perl 5, A007094 (Cracked)

Numbers in base 8

Byte set sub {if($_[1]!=%/)ret-n;}

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ Two r in your byteset \$\endgroup\$
    – Value Ink
    Commented Jul 28, 2017 at 19:00
  • 1
    \$\begingroup\$ I like how your byteset as-is looks like valid Perl. \$\endgroup\$ Commented Jul 28, 2017 at 20:07
  • 1
    \$\begingroup\$ Cracked. \$\endgroup\$ Commented Jul 30, 2017 at 18:05
1
\$\begingroup\$

shortC, A000240, 64 bytes

Uses the characters in this ASCII map:

    "     %     ( ) * + , -     
  1 2                       >   
@ A         F     I             
    R   T             [   ]     
  a     d         i         n o 
p       t     w       {   }    

Map credit: ETHproductions

\$\endgroup\$
1
  • \$\begingroup\$ By far the most random place I've ever found myself given credit for something :P \$\endgroup\$ Commented Aug 4, 2017 at 0:50
1
\$\begingroup\$

CPython 3.6.2, A000796 (cracked)

I like Latin-1. Here's another 70 characters.

,Ðûô[u÷ÎÆ»énb¤Äö]?có´å¡ùÇõÓ«;Ñ$èñÙdÁ¼
¢üÔltsð½(þÚ#ä.×çÈýŧã¯\)³íï¬Â±¥_Ê=iÌ

This bunch of characters can calculate the decimal digits of pi. Surely this requires flow control. And yet there isn't a colon, so that is impossible. You can't even eval a string when there is neither eval nor a string.

I'll give a hint: my program takes input from stdin and outputs to stdout, but I am almost completely certain that it is possible to use other I/O methods.

\$\endgroup\$
8
  • \$\begingroup\$ For anyone wondering, the available ASCII chars are #$(),.;=?[\]_bcdilnstu and newline, and the non-ASCII ones are ¡¢¤¥§«¬¯±³´»¼½ÁÂÄÅÆÇÈÊÌÎÐÑÓÔ×ÙÚãäåçèéíïðñóôõö÷ùûüýþ. \$\endgroup\$ Commented Jul 31, 2017 at 14:22
  • \$\begingroup\$ @ETHproductions Now you've spoiled it! :-) At least it makes my love of FreeBSD clear. \$\endgroup\$
    – wizzwizz4
    Commented Jul 31, 2017 at 14:32
  • \$\begingroup\$ It's really not hard to sort the charset... :P Now I'm thinking this must be a template of some sort, since your other answer uses exactly the same ASCII set. I don't know zip about why you would be so specific about CPython 3.6.2 though, so I'll leave that to the Python experts... \$\endgroup\$ Commented Jul 31, 2017 at 14:35
  • \$\begingroup\$ @ETHproductions It's because the subset I've chosen is Turing complete. It's because I'm not about to claim that it works in a version that I haven't tested it in, and I've been very hackish. \$\endgroup\$
    – wizzwizz4
    Commented Jul 31, 2017 at 14:52
  • 1
    \$\begingroup\$ Cracked, almost twice as long as the other two cracks. \$\endgroup\$ Commented Aug 4, 2017 at 18:22
1
\$\begingroup\$

cQuents, A033307, Safe

Fe_pz:"/`'-2;

Try it online!

Explanation:

":z--F_p-2
Try it online! ": means a char sequence; basically, the output needed. Now, we need to just get the current index, which would usually be $. z starts out as 0 and is the previous number from then on, so we need just to add one to it. -- is the equivalent of +, and F_p-2 means Floor(Pi-2), which works.

\$\endgroup\$
1
\$\begingroup\$

Perl 5 -n, A000290: the squares, score:18, safe.

 ;cdeghijklnopqrst

Rules

  • Input from stdin, as a string of decimal integer.

Intended solution

int or print;int or die;int ne length q q q or print;int ne length q q q or die;s ss s;chr sqrt length eq chr or redo;print length

Try it online!

Usage: from stdin, as a decimal integer. 0-indexed. Can accept only a line. Input shall match /^\d+$/. No trailing LF to your input. Output from stdin, as decimal integers. If your input is 0 or 1, the program dies but please don't care for such thing; this specification is just for this challenge.

\$\endgroup\$
0
\$\begingroup\$

R, A000027 (Cracked)

An easy one to warm up :)

Byteset:

eiytnd

Solution:

identity returns the input, so maps n to n.

\$\endgroup\$
4
  • \$\begingroup\$ Cracked? \$\endgroup\$
    – Shaggy
    Commented Jul 27, 2017 at 17:36
  • \$\begingroup\$ @Shaggy Wouldn't that just return the integer? Shouldn't it return a whole sequence? Or maybe Jarko misunderstood? \$\endgroup\$
    – Mr. Xcoder
    Commented Jul 27, 2017 at 17:37
  • \$\begingroup\$ @MrXcoder: Or maybe I did! :D \$\endgroup\$
    – Shaggy
    Commented Jul 27, 2017 at 17:39
  • \$\begingroup\$ It should return the nth entry, so this works. \$\endgroup\$
    – JAD
    Commented Jul 27, 2017 at 17:44
0
\$\begingroup\$

Python 2, 24 bytes, A001246, cracked

Byte set:


 )(+*-/12:=<acbdfmlonrx

Try it online!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$
    – Mr. Xcoder
    Commented Jul 27, 2017 at 18:31
  • \$\begingroup\$ Agh, no fair. :P \$\endgroup\$ Commented Jul 27, 2017 at 18:31
0
\$\begingroup\$

Python 2, 21 bytes, A157433, cracked


6ut1 28rp5=)ni+03(*7

Try it online!

Original solution:

n=input() print 128*n**2+2336*n+10657

Probably super easy, but eh, I have =).

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Cracked. \$\endgroup\$
    – Adnan
    Commented Jul 27, 2017 at 18:59
  • \$\begingroup\$ Well, I had already posted this, so double cracked. \$\endgroup\$ Commented Jul 27, 2017 at 19:04
0
\$\begingroup\$

Jelly, 16 bytes, A000042 (Cracked)

Byte Set:

%1@JOiv¤ØȷḌṁị“”€

(The two quotes are different: one is opening and the other is closing).

(uses Jelly codepage)

The sequence is: a(n) is the unary representation of n.

\$\endgroup\$
3
  • \$\begingroup\$ This challenge requires you to submit a character set to use rather than a list of characters \$\endgroup\$
    – Blue
    Commented Jul 27, 2017 at 19:07
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – Adnan
    Commented Jul 27, 2017 at 19:13
  • \$\begingroup\$ Well a character set rather than list makes this quite a bit easier. \$\endgroup\$ Commented Jul 27, 2017 at 19:16
0
\$\begingroup\$

Python 3, 19 byteset, A000290, Cracked

This is the perfect squares: 0, 1, 4, 9, ....

Byteset:

(fam, l+db-ise=10:)

Note: I had two iterations with duplicate characters (and missing characters) because I'm dumb.

My solution (not very efficient):

f=lambda l,a=1,b=0:f(l-1,a+1+1,b+a) if l else b

Try it online!

\$\endgroup\$
6
  • \$\begingroup\$ Why are there two as in the byteset \$\endgroup\$ Commented Jul 27, 2017 at 20:52
  • \$\begingroup\$ @ppperry my bad, sorry. Fixed. \$\endgroup\$
    – Stephen
    Commented Jul 27, 2017 at 21:02
  • \$\begingroup\$ still two 1s. \$\endgroup\$ Commented Jul 27, 2017 at 21:12
  • \$\begingroup\$ @ppperry I don't know why this was so hard - I believe it's fixed now, so sorry 0.o \$\endgroup\$
    – Stephen
    Commented Jul 27, 2017 at 21:17
  • 1
    \$\begingroup\$ Cracked! \$\endgroup\$
    – lynn
    Commented Jul 27, 2017 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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