Wednesday, September 5, 2018

Difference between sum of even positioned digits and sum of odd positioned digits in a number is equal to 1

A "Good Number" is a number whose difference between the sum of its digits at even places and the sum of digits at odd places is $1.$




For example, $234563$ is a good number.



Digits at odd location are $3,5,3$ (unit place is location 1).
Digits at even location are $2,4,6$.
Diff $=(2+4+6)-(3+5+3)=12-11 = 1$.




And 123456 is not a good number, because
diff=$(5+3+1)-(2+4+6)=9-12 = -3$.




Good Numbers from 1 to 100 are $$10,21,32,43,54,65,76,87,98$$
So my question is, in a given range, like 1 to 100 or 1 to 1000 for
instance is there a way to find out how many numbers in the range are
good numbers without actually having to test each number?




I figured out that all good numbers when divided by 11 would yield a
remainder 10. But the converse is not true (if 109 is divided by
11 would yield a remainder 10, but it is not a good number).



I also came across a similar question where given a
range we need to find the numbers that on finding the difference
between Sum of digits at even location and Sum of digits at odd
location would yield a prime number. Since finding difference between the
sum of even and odd positioned digits is the base for both the
problems it would be of great help if someone could help me with

this...



Thanks in advance.....

No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...