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?
A
with ab
and appending a.txt
. For example oeis.org/b4.txt would access the b-files for that sequence. \$\endgroup\$