An amusing puzzle from comp.lang.apl posted on 2008-04-23
http://groups.google.com/group/comp.lang.apl/browse_thread/thread/1836e834b63cfb29/f2a9ba479d6419b0?lnk=gst&q=%2244%2C45%2C46%22#f2a9ba479d6419b0

Take the UK national lottery - it has 6!49 combinations where the 
first (1,2,3,4,5,6) and the last (44,45,46,47,48,49) have each got a 
sum and the number of combinations that have the same respective 
sum is exactly 1. The objective was to list each sum between the 
2 with the number of combinations ... quickly. After a lot of experimentation, 
the solution ran in less than 2 minutes on a 1.6 GHz Pentium processor. 

({.,#)/.~ +/"1 ] 6 comb 49

The array 6 comb 49 would require at least */4 6,6!49 or 335611584 bytes.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to