Determine the minimum value of a positive integer N that satisfy the following conditions:
- N is a multiple of 101.
- N starts with and ends in 98.
- sod(N) = 94
*** sod(N) denotes the sum of the digits of N.
For example, sod(3456) = 3+4+5+6 = 18
Since 94/9 = 10.44 etc, the number must contain at least 11 digits.
Starting with 98000000098 which is 68 mod 101, incrementally adding 100 preserves the 98 suffix and decreases the mod 101 value by 1. Therefore 98000006898 is 0 mod 101.
Now incrementally adding 10100 will continue to be a number both divisible by 101 and ending in 98; but not all will have the correct sod.
I wrote a function to determine the smallest number of n digits to start and end with 98 and a middle part of n-4 digits which is zero mod 101. (ie the smallest middle part)
n first one
11 98000006898
12 980000000098
13 9800000002798
14 98000000009598
Looping through the number of digits, checking only every 10100th number made the program run pretty fast.
I found 2520 12-digit numbers that fit all the criteria.
The smallest I found was 983939999998 which has an sod of 94 and is divisible by 101
|
Posted by Larry
on 2023-07-04 08:08:26 |