# Digital Numbers using all digits from 1-9

Call a number a digital number if it consists of all the digits from 1-9, each used exactly once. What is the probability that a digital number will be divisible by 7 ? What is the probability that a digital number will be of the form 9p, where p is a prime?

-
What haven't you tried? – Gigili Jul 4 '12 at 17:59
My approach would be to write a program to find all the pandigital numbers divisible by 7 and all those of the form 9p. Shouldn't be too hard. – tomasz Jul 4 '12 at 18:14
I don't know how or why, but I have a hunch that the fact that $1001$ is divisible by $7$ will turn out to be useful. This implies that $$1000000a+1000b+c\equiv a-b+c\pmod7.$$ This means that for a digital number to be divisible by seven, we must have the equation $b=a+c\pmod 7$, where $a,b,c$ are the integers formed by groups of three digits, starting from the most significant. – Jyrki Lahtonen Jul 4 '12 at 18:14
@Yamini There is no chance of an elegant solution to the $9p$ problem, unless the probability is $0$. And since $123458679$ is nine times a prime, the probability is non-zero. – Erick Wong Jul 4 '12 at 18:31
Matlab results for the first problem: out of 362880 digital numbers, 51752 are divisible by 7. – Cocopuffs Jul 4 '12 at 19:01