For a given integer $x>0$, I need to find all integers $a \in [0, 10^{15}]$ which have the following property: the digit sum of $a$ equals the digit sum of $x\cdot a$.


I found this link <http://mathworld.wolfram.com/CastingOutNines.html> which looks quite relevant to my task, but I can't figure out how to apply it.


Any ideas? 



Finding integers whose sum of digits equals the sum of the digits of a multiple of them
If you wish to get the property $S(a)=S(xa)$ (where $S(\cdot)$ denotes the sum of decimal digits) valid for all positive integers $x$, then there are no such numbers $a$. Indeed, if such an $a$ existed, then concantination $\overline{aa}=a\cdot x$ with $x=10^n+1$, $n$ the number of digits in $a$, would give you a number $xa$ with sum of digits twice more than $S(a)$.


I put the answer because my comments on clarifying the problem were ignored.


