26
2
If you think this could be fun, but too much work, consider participating in this much smaller challenge.
A bit of fun (and possibly frustration!) for 2016... Dyalog's "puzzle of the year". Enjoy!
The Objective
Find Dyalog APL (download) expressions (other languages are allowed, see Eligibility below) involving exactly the digits 2 0 1 6 in that order to equal the numbers 0 to 100. For example:
20=16
×2016
2⌊016
2+0+1*6
...
The aim is to use as few characters as possible in each expression (the minimum number of characters for an expression is 5 – the four digits 2 0 1 6 and a single primitive function/operator).
The Rules
- Each expression must contain the digits 2 0 1 6 (in that order) and no other digits. Pre-set constants and variables are also not allowed.
- In addition to the four digits 2 0 1 6, only built-in symbols and names, parentheses/braces, spaces, high minus signs and decimal points can be used. The resultant expressions must be deterministic (that is, give the same result on repeated evaluations). For non-APLs, functions/operators with a name are also allowed; same rules as here.
- Assume all default settings for your language. For Dyalog APL, this means
⎕ML
and⎕IO
are both 1, and⎕PP
is 10. - Each entry comprising correct expressions for all the numbers from 0 to 100 inclusive will be rated according to the number of characters used by those expressions excluding redundant spaces (minimum 505 for all 101 expressions).
Eligibility
Anyone can enter. You may answer in any language, but only APL answers will be considered for accepting. If you use another language than APL, you may use snippets, programs, functions, etc. as alternatives to expressions, and you may print, leave the number in an accessible memory location, or otherwise return the result, as long as your code directly evaluates to the desired number as any standard numeric data type for your language.
Closing Date
30 November 2016.
Prizes
- Have your answer accepted
- Be immortalised in Dyalog's 2016 Hall of Fame!
Submitting Your Entry
After 30 November 2016, I will accept the shortest answer, and submit your answer, in your name, to Dyalog's 2016 Hall of Fame.
FAQ
- Is
J
(e.g. 37=⌈⍟!20J16
) allowed? - No: In addition to the four digits 2 0 1 6, only only built-in symbols and names, parentheses/braces, spaces, high minus signs and decimal points can be used.
- Is output as a string acceptable?
- No: equal the numbers 0 to 100.
- Physical digits, or data digits?
- Data digits, as per OP: same rules as here, where one of the examples contain
LOG10(
. - Is assigning variables then using them as part of the expression (e.g. 56=
a+16+a←20
) allowed? - Yes, but you may not use an assignment from one expression in another one.
I have explicit written permission to post this challenge here from the original author of this challenge. Feel free to verify by following the provided link and contacting the author. I gave the original competition author the link to this page within the minute I posted it, so they can check if I submit someone's answer as my own.
Related: http://codegolf.stackexchange.com/q/48917/34718
– mbomb007 – 2016-03-03T17:04:49.813So many answer and no one APL solution? – Akangka – 2016-09-16T14:45:02.220
1@ChristianIrwan Right, that is to be expected: anyone doing it in APL may rather want to submit to the real competition instead of revealing his secrets here. – Adám – 2016-09-16T14:58:02.140
@Adám, this might be late, but would using
⎕ML
and⎕IO
(assumed to be1
) be acceptable? – Zacharý – 2016-12-03T21:29:47.937@ZacharyT You mean putting quad names into the expression? Sounds like a lot of extra characters for little win. Can you give me an example? – Adám – 2016-12-04T09:37:07.243
⎕IO+20+16
for 37. – Zacharý – 2016-12-04T15:10:30.070@ZacharyT Same count, no question:
20(++≠)16
– Adám – 2016-12-04T15:51:32.223Sorry, bad example.
⎕PP+20∧1⊢6
for 70. – Zacharý – 2016-12-04T22:08:07.597@ZacharyT Yes, that is ok. I've updated OP. – Adám – 2016-12-05T13:27:51.393
Just to be sure, that would be acceptable for the actual Dyalog submission, correct? Nothing of
– Zacharý – 2016-12-06T22:22:22.950⎕PP
was specified http://dyalog.com/2016-year-game.htmYes, I asked my colleague in charge of the the official competition. Btw,
⎕PP=10
, not 6 as on TryAPL. – Adám – 2016-12-06T22:28:28.613