Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's special about 787?

In ghci, using the arithmoi package:

Math.NumberTheory.Powers.General> :set +s
Math.NumberTheory.Powers.General> integerRoot 786 ((10^32)^786)
100000000000000000000000000000000
(0.04 secs, 227,064 bytes)
Math.NumberTheory.Powers.General> integerRoot 787 ((10^32)^787)

After five minutes, it still hasn't responded. Why is it taking so long?

(From some ad-hoc testing, it appears to be slow for all choices larger than 787 and fast for all choices smaller.)

like image 210
Daniel Wagner Avatar asked Jul 12 '17 21:07

Daniel Wagner


People also ask

Why is the 787 more comfortable?

The 787 promised passenger comfort One of the promises of the 787 was improved passenger comfort. There are several improvements in this area, including higher cabin air pressure. The cabin is pressurized at 6,000 feet, as opposed to 8,000 feet on most other aircraft, including the 777.

Why is 787 so fuel efficient?

The new airplane's use of electrical systems reduces fuel usage and increases operational efficiency. the primary differentiating factor in the systems architecture of the 787 is its emphasis on electrical systems, which replace most of the pneumatic systems found on traditional com mercial airplanes.

What is good about Dreamliner?

Excellent design choices all around. Better sleep on long flights. Because the 787 is pressurized at about 6,000 feet rather than 8,000 feet, you'll breathe easier. More oxygen in your lungs means better sleep, less chance of headache, no difficulty breathing (flying at altitude is like sleeping at a ski resort).

Why is it called a 787?

But after the September 11, 2001 attacks fuel prices went up, so airlines wanted more efficient planes rather than faster ones. Boeing cancelled the Sonic Cruiser and replaced it in January 2003 with the "7E7," which was the code name for the 787 at the time.


Video Answer


1 Answers

arithmoi implements integerRoot by getting an initial approximate root and refining its guess with Newton’s method. For (1032)786, the second approximation gets a really good starting point:

> appKthRoot 786 ((10^32)^786)
100000000000000005366162204393472

For (1032)787, the second approximation gets a really bad starting point. Like, really bad.

> appKthRoot 787 ((10^32)^787)   
1797693134862315907729305190789024733617976978942306572734300811577326758055009
6313270847732240753602112011387987139335765878976881441662249284743063947412437
7767893424865485276302219601246094119453082952085005768838150682342462881473913
110540827237163350510684586298239947245938479716304835356329624224137216

It actually gets this approximation for everything starting there.

> length $ nub [appKthRoot x ((10^32)^x) | x <- [787..1000]]
1

Anyway, putting in the important parts of appKthRoot, we get:

> let h = 106; k = 786; n = (10^32)^k; !(I# s) = h * k - k in floor (scaleFloat (h - 1) (fromInteger (n `shiftRInteger` s) ** (1/fromIntegral k) :: Double))
100000000000000005366162204393472

> let h = 106; k = 787; n = (10^32)^k; !(I# s) = h * k - k in floor (scaleFloat (h - 1) (fromInteger (n `shiftRInteger` s) ** (1/fromIntegral k) :: Double))
179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216

and taking a look at what’s going into scaleFloat:

> let h = 106; k = 786; n = (10^32)^k; !(I# s) = h * k - k in fromInteger (n `shiftRInteger` s) ** (1/fromIntegral k) :: Double
2.465190328815662

> let h = 106; k = 787; n = (10^32)^k; !(I# s) = h * k - k in fromInteger (n `shiftRInteger` s) ** (1/fromIntegral k) :: Double
Infinity

Yeah, that’d do it. (1032)786 ÷ 282530 &approx; 21023.1 fits in a double, but (1032)787 ÷ 282635 &approx; 21024.4 does not.

like image 139
Ry- Avatar answered Sep 25 '22 03:09

Ry-