[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

226.0. "A problem in squares" by METOO::YARBROUGH () Mon Feb 25 1985 11:28

Here's a problem rephrased from an early issue of Creative Computing 
Magazine:

Consider the set of permutations of 00112233445566778899. Some of these
permutations contain subsequences which are squares: for example,
38998144525006677231 contains the squares 81, 144, 25, 2500. The lengths
of the subsequences are 2, 3, 2, 4 and the sum of those is 2+3+2+4=11.
(We are interested only in squares of length >1; 0, 1, 4, and 9 don't
count.) 

Problem: find a permutation of 00112233445566778899 that maximizes the sum
of the lengths of subsequences that are squares.

Lynn Yarbrough
T.RTitleUserPersonal
Name
DateLines
226.1SPRITE::OSMANTue Feb 26 1985 15:015
One of my first reactions to the problem, other than it being basically
interesting, is that since we''re dealing with the squares of up to ten
digits, the squares don't fit in 32 bits, so it seems like it will be 
difficult to work on this problem in Bliss.

226.2LATOUR::AMARTINTue Feb 26 1985 21:152
So use Bliss-36.
				/AHM
226.3METOO::YARBROUGHWed Feb 27 1985 13:433
I originally solved the problem using a TI-58 calculator and some ingenuity.
An exhaustive search is going to chew up tons of CPU time, so some ideas to
trim the search are needed.
226.4SPRITE::OSMANThu Feb 28 1985 17:0411
To the wise guy that said to use BLISS36:  I meant that we're dealing
with the SQUARES of 10-digit numbers, so we're dealing with 20-digit 
numbers, so BLISS36 probably isn't any better than BLISS32.

As far as TI-58, how many digits of exact integer arithmetic does that
calculater have ?

p.s.	Yes, I was starting to realize that brute force was going to
	be unavailable, so I was starting to think about methods that
	eliminate lots of things.  Now that you've admitted you actually
	SOLVED the problem, I'm more motivated.  Thanks.
226.5METOO::YARBROUGHFri Mar 01 1985 09:443
The TI-58 has 10 display digits and two guard digits. I actually used it 
mostly to explore the 10 MOST significant digits after I had a pretty good
idea what the least significant digits would look like.
226.6LATOUR::AMARTINMon Mar 04 1985 21:466
Re .4:

So you'd rather use triple precision on a Vax than double precision on
a PDP-10?  Perhaps you should use Bliss-10, then you could declare
REGISTER variables of type VECTOR[2].
				/AHM
226.7TURTLE::GILBERTMon Mar 04 1985 22:003
re .4
	Is it assured that the "ideas to trim the search" won't also
	trim the sought-after maximum from the search?
226.8SPRITE::OSMANFri Mar 08 1985 10:4030
I think we can all assume that anything that "trims the search" doesn't
throw out the baby with the bath water by definition.  Otherwise it's
useless.

For motivation, Lynn, please tell us:  Have you actually SOLVED this for THE
maximum answer ?

I'm still thinking about it during various leisuremind
every day.  I haven't gotten too far.  I've been trying to see what sorts
of inspections might dictate that I no longer have to look at some large
set of squares.  For instance, suppose I found this:

		x x x x x\x x x x x\x x x x x\x x x x x
		        y y       y y       y y

That is, suppose I've found one permutation such that there are four
five-digit squares plus three two-digit ones formed at the boundaries.
That permutation gets a score of 4*5+3*2 = 26.  Once I've found this
permutation, can I prove somehow that I don't need to try any squares
larger than some ??? number of digits in size since such squares can't
possibly help me do better than 26.  Or instead of "larger than some number
of digits", maybe some other large set.

Or maybe the score of 26 combined with the fact that we're dealing with a
permutation, so digits can "used up" in a sense, will help.

I'm sort of thinking out loud here, but maybe a company-wide joint solution
could be fun and productive ! So if you've "gotten anywhere at all" on this
problem even though not far, you might consider sharing even though you
don't have a complete solution yet.
226.9METOO::YARBROUGHMon Mar 11 1985 11:432
Here's a hint: I found a very large solution (>100) which I am not certain
is the absolute maximum. The longest square in my solution was 16 digits.
226.10METOO::YARBROUGHThu Nov 14 1985 09:3627
It's been several months since the previous reply, so I'll record my solution.

The permutation 49497813631827562500 contains the following squares:
49 (twice)     		 4
81			 2
36			 2
25	       		 2
2500	       		 4
625	       		 3
62500	       		 5
5625			 4
562500			 6
75625	       		 5
7562500	       		 7
275625	       		 6
27562500       		 8
18275625       		 8
1827562500     		10
78136318275625 		14
7813631827562500	16
                          
Total		       106

I dimly recall hearing of a solution of 107, but I can't reproduce it. There
are other 106 solutions.

Lynn Yarbrough