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. 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;
?>