I wrote:
> 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?  

Raul responded:
>  I have not really deciphered this paragraph,

How about an example?

           NB.  A bunch of "weird" numbers
           listOfN =: 4294967296 4096 65536  

           NB.  Not so "weird" if considered in hexadecimal
           16 #.^:_1: listOfN 
        1 0 0 0 0 0 0 0 0
        0 0 0 0 0 1 0 0 0
        0 0 0 0 1 0 0 0 0

          16b100000000 16b1000 16b10000  -: listOfN      
        1

So, your task, if you choose to accept it: given (listOfN), produce (16).    
But in the general case, it may not be so pretty.  It
may be that most of the numbers in the list are rounder in a given base, but 
others remain "weird".  The goal is to choose a base
that makes as many numbers as possible round.

However, given my original spec as described in J, the goal could be rendered 
as "make the list as round as possible", which could
be satisfied by either "choosing a base that makes as many numbers as possible 
round" or " choose a base that makes a few numbers
really really round" (because "list as round as possible" = "+/ roundness of 
each number").

-Dan

 

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

Reply via email to