The number 1316 is expressed as the sum of two numbers, one of which is a multiple of 13 and the other is a multiple of 11 .. Algorithm Analysis: 1316. Obviously, 1300 is a multiple of 13, but 16 is not a multiple of 11. we can think that if we subtract a multiple of N 13 from 1300, the result is still a multiple of 13, then, we only need to add 16 to the subtraction algorithm analysis:
1316. Obviously, 1300 is a multiple of 13, but 16 is not a multiple of 11. it can be thought that the result is still a multiple of 13 after any number of 13 is subtracted from 1300, so long as 16 is added with the multiples of N 13 minus this and 11, the two numbers are solved. There may be more than one answer, but we only need one solution.
It is not difficult to observe: (16 + 13*3) + (1300-13*3) = 1316, but we need to implement it using code:
The code is as follows:
$ N = 1316;
$ I = 0; // minus the nth 13, initialize to 0
$ Y = 16 + 13 * $ I; // The 16 split from 1316 plus N 13, which is initialized as 16
While ($ y % 11! = 0) {// if the sum of 16 plus N and 13 cannot be divided into 11
$ I ++; // add another 13
$ Y = 16 + 13 * $ I;
}
Echo '$ x ='. ($ n-$ y ).'
';
Echo '$ y ='. $ y;
?>
Limit 1316, obviously 1300 is a multiple of 13, but 16 is not a multiple of 11. it can be thought that the result is still a multiple of 13 after any number of 13 is subtracted from 1300, so we only need to add 16 minus...