Given positive integer scalar N, what is the smallest base in which N is a
"round number"?  A round number is a number that ends in zero digits; the
more trailing 0 digits, the rounder the number.  

That is, provide a verb (roundest) such that with (roundestBase =. roundest
N) then (roundestBase) is minimized and (roundestBase trailingZeros N) is
maximized, where (trailingZeros =: [: +/ 0 *./\.@:= #.^:_1:).  As an
extension, given a list of positive integers, what is the smallest base in
which the greatest amount of numbers from the list are round?  That is,
given (roundestBase =. roundest listOfN), then minimize (roundestBase) and
maximize (+/ roundestBase trailingZeros"0 listOfN).  I suppose this latter
means roundestBase could either identify one really round number, or a bunch
of less-round numbers.

I haven’t thought this through much, so feel free to tweak the spec a bit;
e.g. to avoid the edge case that N=1.  Just make a (prominent) note of it
when you submit your solution.  The usual standards of novelty, brevity,
velocity and parsimony apply.

-Dan

PS:  Creative cheats like  roundest=:#&1  are also encouraged.  (But of
course that one’s no good, because it will hardly "minimize" roundestBase.)


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to