A year is called a Subtractive year when the absolute difference between the number formed by the first two digits and the number formed by the last two digits is equal to the number formed by the middle two digits.
For example, considering the year 3482, we observe that the absolute difference between 34 and 82 is 48, which is the number formed by the middle two digits, so that 3482 is a subtractive year. Likewise for the year 4220, the absolute difference between 42 and 20 is 22, so that 4220 is also a subtractive year.
(i) Determine the total number of subtractive years from years 1000 to 9999 inclusively.
(ii) What are the respective first and last subtractive years from years 2000 to 2999 inclusively?
(iii) What are the respective first and last subtractive years in the period covered under (i)?
Mathematica:
(49) solutions for (10a+b)-(10c+d)=10b+c
{{a == 1, b == 1, c == 0, d == 1}, {a == 2, b == 0, c == 1, d == 9}, {a == 2, b == 1, c == 1, d == 0}, {a == 2, b == 2, c == 0, d == 2}, {a == 3, b == 0, c == 2, d == 8}, {a == 3, b == 2, c == 1, d == 1}, {a == 3, b == 3, c == 0, d == 3}, {a == 4, b == 0, c == 3, d == 7}, {a == 4, b == 1, c == 2, d == 9}, {a == 4, b == 2, c == 2, d == 0}, {a == 4, b == 3, c == 1, d == 2}, {a == 4, b == 4, c == 0, d == 4}, {a == 5, b == 0, c == 4, d == 6}, {a == 5, b == 1, c == 3, d == 8}, {a == 5, b == 3, c == 2, d == 1}, {a == 5, b == 4, c == 1, d == 3}, {a == 5, b == 5, c == 0, d == 5}, {a == 6, b == 0, c == 5, d == 5}, {a == 6, b == 1, c == 4, d == 7}, {a == 6, b == 2, c == 3, d == 9}, {a == 6, b == 3, c == 3, d == 0}, {a == 6, b == 4, c == 2, d == 2}, {a == 6, b == 5, c == 1, d == 4}, {a == 6, b == 6, c == 0, d == 6}, {a == 7, b == 0, c == 6, d == 4}, {a == 7, b == 1, c == 5, d == 6}, {a == 7, b == 2, c == 4, d == 8}, {a == 7, b == 4, c == 3, d == 1}, {a == 7, b == 5, c == 2, d == 3}, {a == 7, b == 6, c == 1, d == 5}, {a == 7, b == 7, c == 0, d == 7}, {a == 8, b == 0, c == 7, d == 3}, {a == 8, b == 1, c == 6, d == 5}, {a == 8, b == 2, c == 5, d == 7}, {a == 8, b == 3, c == 4, d == 9}, {a == 8, b == 4, c == 4, d == 0}, {a == 8, b == 5, c == 3, d == 2}, {a == 8, b == 6, c == 2, d == 4}, {a == 8, b == 7, c == 1, d == 6}, {a == 8, b == 8, c == 0, d == 8}, {a == 9, b == 0, c == 8, d == 2}, {a == 9, b == 1, c == 7, d == 4}, {a == 9, b == 2, c == 6, d == 6}, {a == 9, b == 3, c == 5, d == 8}, {a == 9, b == 5, c == 4, d == 1}, {a == 9, b == 6, c == 3, d == 3}, {a == 9, b == 7, c == 2, d == 5}, {a == 9, b == 8, c == 1, d == 7}, {a == 9, b == 9, c == 0, d == 9}}
(41) solutions for -(10a+b)+(10c+d)=10b+c
{{a == 1, b == 0, c == 1, d == 1}, {a == 1, b == 1, c == 2, d == 3}, {a == 1, b == 2, c == 3, d == 5}, {a == 1, b == 3, c == 4, d == 7}, {a == 1, b == 4, c == 5, d == 9}, {a == 1, b == 4, c == 6, d == 0}, {a == 1, b == 5, c == 7, d == 2}, {a == 1, b == 6, c == 8, d == 4}, {a == 1, b == 7, c == 9, d == 6}, {a == 2, b == 0, c == 2, d == 2}, {a == 2, b == 1, c == 3, d == 4}, {a == 2, b == 2, c == 4, d == 6}, {a == 2, b == 3, c == 5, d == 8}, {a == 2, b == 4, c == 7, d == 1}, {a == 2, b == 5, c == 8, d == 3}, {a == 2, b == 6, c == 9, d == 5}, {a == 3, b == 0, c == 3, d == 3}, {a == 3, b == 1, c == 4, d == 5}, {a == 3, b == 2, c == 5, d == 7}, {a == 3, b == 3, c == 6, d == 9}, {a == 3, b == 3, c == 7, d == 0}, {a == 3, b == 4, c == 8, d == 2}, {a == 3, b == 5, c == 9, d == 4}, {a == 4, b == 0, c == 4, d == 4}, {a == 4, b == 1, c == 5, d == 6}, {a == 4, b == 2, c == 6, d == 8}, {a == 4, b == 3, c == 8, d == 1}, {a == 4, b == 4, c == 9, d == 3}, {a == 5, b == 0, c == 5, d == 5}, {a == 5, b == 1, c == 6, d == 7}, {a == 5, b == 2, c == 7, d == 9}, {a == 5, b == 2, c == 8, d == 0}, {a == 5, b == 3, c == 9, d == 2}, {a == 6, b == 0, c == 6, d == 6}, {a == 6, b == 1, c == 7, d == 8}, {a == 6, b == 2, c == 9, d == 1}, {a == 7, b == 0, c == 7, d == 7}, {a == 7, b == 1, c == 8, d == 9}, {a == 7, b == 1, c == 9, d == 0}, {a == 8, b == 0, c == 8, d == 8}, {a == 9, b == 0, c == 9, d == 9}}
90 solutions in all. The others things asked for are bolded.
Edited on December 12, 2012, 2:01 pm
|
Posted by broll
on 2012-12-12 13:59:26 |