[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

240.0. "A permutation puzzle" by METOO::YARBROUGH () Mon Mar 18 1985 18:39

What permutation of the 10 decimal digits, viewed as an integer, has the
minimum number of 1's in its binary representation?

As there are 10! permutations and the number of bits is in the low 30's
there are many replications for each number of 1's; so we can look for the
permutation of least value with the minimum number of bits. Of course we
won't know it's the minimum unless we look at them all or find some way of
trimming the search tree...

[I don't currently have a solution for this problem.][29~
T.RTitleUserPersonal
Name
DateLines
240.1TAV02::NITSANTue Mar 19 1985 04:5123
* There are about 30 numbers with one bit "on" in the appropriate range, and
  none is a decimal permutation.

* There are about 30**2 numbers with two bits "on" in that range, and none is
  a decimal permutation.

* There are about 30**3 numbers with three bits "on" in that range, and 3 of
  them ARE decimal permutations:
    2**0 + 2**20 + 2**32  =  4296015873
    2**1 + 2**21 + 2**33  =  8592031746
    2**2 + 2**30 + 2**32  =  5368709124

The whole thing runs in a few seconds (30**3 is not much..). To check whether
a 10 digit number is a permutation you need a single pass on its digits,
turning on (.OR.) one of 10 flag bits for each digit, and finally see if you
got flag = '1111111111'B (= 1023).

Also, to check for MAXIMUM number of bits instead of minimum, I think the
complementary method will work: Produce numbers with one bit "off" (by
SUBTRACTION of different powers of 2 from 111...111), and then with two bits
"off", etc.
                                                         ????
                                                        NITSAN
240.2MANANA::COLGATETue Mar 19 1985 17:178
On a side note, there are 33 bits in a ten digit (decimal) number. In which
case there are 33!/(32!*1!) = 33 with one bit on, 33!/(30!*2!) = 528 with
two bits on, 33!/(29!*3!) = 5456 with three bits on. That's less than the
estimates given in .1. To write a program that can remove the duplicates
efficiently is left as an exercise to the reader.

Wim

240.3METOO::YARBROUGHFri Mar 22 1985 11:351
I think it's neat that one of the solutions is exactly twice another!