Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ob. 5 Thunder-split numbers: An integer n is called a thunder-split number if it

ID: 3585743 • Letter: O

Question

ob. 5 Thunder-split numbers: An integer n is called a thunder-split number if it can be split into two e story behind the term thunder-split is this: An Indian mathematician travelling in a foreign and 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 quickly realized that (3025)2 552 3025, thus he named any integer having this property as a numbers, and the square of the sum of these two numbers equals to the original number thunder-split number Besides 3025, we see that 9801 is also a thunder 01, and (98+01)2 992 9801. Similarly, 81 is such a number since (8+19 is such as number since (10+0)2-100, and 60481729 is such a number since (6048 + 1729) 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 num align in place): 81 can be thunder-split as (8 100 can be thunder-split as (10 2025 can be thunder-split as (20 3025 can be thunder-split as (30 +0 + 25 + 25 e+2 4941729 can be thunder-split as (494 +17292 7441984 can be thunder-split as (744 + 1984 ).2 25502500 can be thunder-split as (2550 +2500).2 9980001 can be thunder-split as (9998 + 0001.2 10 Note: the above lines are part of the results for [10, 10°], for this problem you only need to print out all thunder-split numbers in [10, 10"] (because when m 10 it will take very long to compute if you do not find a more efficient way) 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)

Explanation / Answer

Function for printing thunder split numbers from 10 to m(in c language)

tsplit_nums(m)

{

for(i=4;i<sqrt(m);i++)

{

int num=i*i;

int left=1,right;

int flag=0;

while(left!=0)

{

for(j=10;j<m;j*=10)

{

right=num%j;

left=num/j;

if(left+right==i)

{

flag=1;

break;

}

}

if(flag)

printf("%d can be thunder - split as(%d + %d)**2",num,left,right);

}

}

}