12
2
As a spin-off to my challenge over at Puzzling, your goal is to output 2016
.
Rules:
- You must include the numbers
10 9 8 7 6 5 4 3 2 1
in that order. They can be used as individual integers or concatenated together (like1098
), but the10
may not be separated into1
and0
- no character(s) may be present between the digits. Note that, in some languages,10
may not actually represent the integer literal10
, which is acceptable. - Your code must not contain any other numbers or pre-defined number variables or constants (so
T
in Pyth is not allowed, since it is a numeric constant). - You must calculate
2016
using numerics. Simply outputting2016
without performing any operations on the required numbers (for example, by decoding an encoded string consisting of only alphabetic characters) is not allowed. Outputting2016
in pieces (such as20
, then16
) is also not allowed; you must have a single output consisting of the numeric value2016
. - The valid answer with the fewest bytes wins.
3@nicael I'm pretty sure solving the puzzle has been done. We've had several of these "insert operators to solve an equation" challenges, but they are exceptional hard to search for. – Martin Ender – 2016-01-06T13:40:50.770
1The previous revision (2) was more interesting actually. The new is just printing the string, the calculation was already made in your puzzling question... – nicael – 2016-01-06T14:19:24.343
1Just a few questions based on what I can see on the current question: 1) Can we calculate
20
and16
and print them one after the other or does the calculated number need to be 2016 before printing? 2) Are functions allowed? 3) Is concatenation of digits allowed? e.g.1098
(I'm assuming yes by previous comments, but just to confirm) 4) Does "calculate 2016 using integers" mean that we can never have floats anywhere in an intermediate step? e.g. can I square root a number and round down? – Sp3000 – 2016-01-06T23:17:35.8971 start="5">
T987654321
?@Sp3000 1 No. 2 No. 3 Yes. 4 Floats are OK as long as you don't break any other rules. 5
10
must be included so you would need to handle that somehow. 6 As long as10
appears beforeT
. – rybo111 – 2016-01-07T00:15:38.233Thanks for clarifying. Just regarding 5 and 6, does "10" must be included mean the character 1 then the character 0, or something that represents the number ten? I think that's what I was confused about. – Sp3000 – 2016-01-07T00:23:51.363
@Sp3000
1
then0
immediately after. Imagine if I use Find on your code and search for10
. If it doesn't exist, it's not a valid entry. – rybo111 – 2016-01-07T00:27:20.683k, that makes sense. Sorry for the question barrage! – Sp3000 – 2016-01-07T00:30:31.313
Clarification about Pyth:
T
is a variable, not a constant. – isaacg – 2016-01-08T09:19:38.403