Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PYTHON Bonus 10 points: Find a way to speed up your code so that you can compute all the thunder- split numbers in [10,109]. In
PYTHON
Bonus 10 points: Find a way to speed up your code so that you can compute all the thunder- split numbers in [10,109]. In this case, your results would cover all of the numbers listed above. If done right, your code should take less than 2 seconds to run and finish (even on an aged laptop).
Prob. 5 Thunder-split numbers: An integer n is called a thunder-split number if it can be split into two numbers, and the square of the sum of these two numbers equals to the original number n The story behind the term thunder-split is this: An Indian mathematician travelling in a foreign land encountered a big thunder-storm, during which he saw a stone monument being struck and split in half by the thunder. Interestingly, the stone originally had 3025 on it, after the thunder-split, one part contained 30 and the other contained 25. The mathematician quickljy 25 552-3025, thus he named any integer having this property as a thunder-split number Besides 3025, we see that 9801 is also a thunder-split number because it can be split into 98 and 01, and (9801)2 992 - 9801. Similarly, 81 is such a number sinc (81)22 81; 100 is such as number since (10+0)2-100, and 60481729 is such a number since (6048 1729)2- 77772-60481729 Write a function tsplit_nums (m), where m > 10, that returns all the thunder-split numbers within the range [10,m]. Use your code to find all the thunder-split numbers in 10, 10], print all of them out using the following format (notice the empty spaces used to make the numbers align in place) 81 can be thunder-split as (8 100 can be thunder-split as (10 2025 can be thunder-split as (20 k * k 2 2 3025 can be thunder-split as (30 +252 3 4941729 can be thunder-split as (494 1729)**2 7441984 can be thunder-split as (74419842 6 9 25502500 can be thunder-split as (2550 2500 **2 99980001 can be thunder-split as (9998 0001 *2 Note: the above lines are part of the results for [10, 109], for this problem you only need to print out all thunder-split numbers in [10.107] (because when m 109 it will take very long to compute if you do not find a more efficient waStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started