4 :'wd<.+/(#(%*/)&:! #/.~)@}."1(#~1={."1);<@(1|."1}.,~"1{.(],.%){.(]#~0=|~) 9(-i.)@<.{:)"1@;^:y x'/@do ^:(*@#);._1(,stdin)LF NB. OK within 32-bit signed int for x<=12 & N>=1 NB. 4 :'wd +/(#(%*/)&:!]@#/.~)@}."1(#~1={."1);<@(1|."1}.,~"1{.(],.%){.(]#~0=|~)i.@{:@q:@{.-.~9(-i.)@<.{:)"1@;^:y x'/@do@,&'x'^:(*@#);._1(,stdin)LF NB. faster; arbitrary precision NB. all problems/non-0 answers for given x; brute force, slow, & large; practical x<=6 on my PC NB. 1!:2&2"1 ": 2&A."1 x,. /:~ ({.,#)/.~ */"1 (*/@}.}. (#: i.@(*/))) 10#~ x=. 3