Puzzles/SumToN
< Puzzles
Jump to navigation
Jump to search
Problem
Find interesting equivalents of +/@i..
Constraints
The following constraints are listed in order. That is, sentences which satisfy constraint N equally are selected from by constraint N+1. All sentences must satisfy constraints 1, 2, and 3.
- For an arbitrary non-negative integer N, your verb f must produce the same result as +/i.N. That is, satisfy (f -: +/@i.) N. This constraint is absolute.
- The result must be guarunteed (predicted, fully supported) by the Dictionary. To put it another way, you may not leverage bugs in the implementation (but you may leverage bugs in the documentation). This constraint is absolute.
- Assume you're running under jconsole -jprofile: that is, you may not depend on any sentence having been executed before your own. Put another way, do not rely on the names normally defined by the J standard library. This constraint is absolute.
- Among sentences that satisfy the preceding constraints equally, those with the smallest number of words are preferred. That is, minimize #@:;:.
- Among sentences that satisfy the preceding constraint within a difference of five, those the smallest number of total necessary characters are preferred. That is, minimize #.
- Among sentences that satisfy the preceding constraint within a difference of five, the fastest are preferred. That, is, minimize 6!:2.
- Among sentences that satisfy the preceding constraint within a factor of two, the leanest are preferred. That, is, minimize 7!:2.
Spoiler Alert!
Solutions
No. | Verb | #@;: | # | 100 (6!:2) ,&'(1e7)' |
[: (7!:2) ,&'(1e7)' |
Notes | Author/Sig |
0 | +/@i. | 4 | 5 | 0.0987804 | 6.71098e7 | Canonical | |
1 | 2&! | 3 | 3 | 2.42098e_5 | 1088 | From the asymmetry thread | -- Roger Hui <<DateTime(2007-04-18T04:53:39Z)>> |
2 | 0 _0.5 0.5&p. | 3 | 13 | 4.91962e_6 | 960 | -- Dan Bron <<DateTime(2007-04-17T22:06:52Z)>> | |
3 | -:@(* <:) | 6 | 8 | 6.58184e_6 | 1088 | -- Dan Bron <<DateTime(2007-04-17T22:06:52Z)>> | |
4 | -:@(+ *:)@<: | 8 | 11 | 7.33333e_6 | 1152 | -- Dan Bron <<DateTime(2007-04-17T22:06:52Z)>> | |
5 | -:*<: | 3 | 5 | 6.7774e_6 | 1216 | B Jonas | |
6 | -:@-~*: | 5 | 7 | 2.60715e_5 | 1472 | Brian Schott |