All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Delicate Divisibility (Posted on 2010-10-19)
For a positive base ten integer of the form ABCD drawn at random between 1111 and 9999 inclusively, determine the probability that ABCD is divisible by each of AB, AC, AD, BD and CD; but, not divisible by BC.

Note: Each of the letters in bold represents a digit from 1 to 9, whether same or different.

 No Solution Yet Submitted by K Sengupta Rating: 4.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 by computer | Comment 3 of 7 |

FOR a = 1 TO 9
FOR b = 1 TO 9
ab = a * 10 + b
FOR c = 1 TO 9
ac = a * 10 + c
bc = b * 10 + c
FOR d = 1 TO 9
ad = a * 10 + d
bd = b * 10 + d
cd = c * 10 + d

abcd = ab * 100 + cd
IF abcd MOD ab = 0 THEN
IF abcd MOD ac = 0 THEN
IF abcd MOD ad = 0 THEN
IF abcd MOD bd = 0 THEN
IF abcd MOD cd = 0 THEN

IF abcd MOD bc <> 0 THEN
PRINT abcd
hitCt = hitCt + 1
END IF

END IF
END IF
END IF
END IF
END IF

ct = ct + 1

NEXT
NEXT
NEXT
NEXT

PRINT hitCt; "/"; ct; "="; hitCt / ct

finds

1995
2184
3774

and
3 / 6561 = 4.572474E-04

as there are 9^4 = 6561 numbers tested of which only 3 satisfy the criteria, and 3/6561 = 1/2187 ~= .0004572474.

 Posted by Charlie on 2010-10-19 19:07:05

 Search: Search body:
Forums (0)