About calculator benchmark (8 queens) and fast devices. MS challenge #2
05-02-2017, 07:15 PM
Post: #2
 toml_12953 Senior Member Posts: 1,467 Joined: Dec 2013
RE: About calculator benchmark (8 queens) and fast devices. MS challenge #2
(05-02-2017 05:18 PM)pier4r Wrote:  How does extract_middle_digits work?
Given n, that is a power of 10 of the type 10^d,
its square is equal to 10^(d*2) and it has (d*2+1) digits.

We consider only the last (d*2) digits.
That is: if n=10000, 10000*10000 = 100000000 we consider only 00000000 without the first 1.

Then we 'consider' all the numbers lower than 10^(d*2) with (d*2) digits.
For example if d=4 and the number under process is 1542,
we consider 1542^2 as 02377764 instead of 2377764.

After that we pick the d=4 middle digits, from 02377764 we pick 0264.
So the middle number extracted is 3777.

Sorry to be dense but I don't get it. Is d = log(n)? If so then log(1542) is 3.188... How do you get d=4?

Tom L

Tom L
If you buy a drink for someone in order to congratulate them,
is it a Mazel Tov cocktail?
 « Next Oldest | Next Newest »