 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  3's & 7's (Posted on 2006-04-09) Find the smallest number comprised of only 3’s and 7’s which fits the following conditions:

1) It has at least one 3;
2) It has at least one 7;
3) It is divisible by 3;
4) It is divisible by 7;
5) The sum of its digits is divisible by 3;
6) The sum of its digits is divisible by 7.

 See The Solution Submitted by Jer Rating: 3.2500 (4 votes) Comments: ( Back to comment list | You must be logged in to post comments.) the computer doing the trial and error | Comment 8 of 13 | DEFDBL A-Z
DECLARE SUB permute (a\$)
CLS
a\$ = "3333333777": h\$ = a\$
DO
n = VAL(a\$)
q = INT(n / 7)
r = n - q * 7
IF r = 0 THEN PRINT a\$
permute a\$
LOOP UNTIL a\$ = h\$

yields the 16 smallest such numbers:

3333377733
3333737337
3333773373
3337333377
3337737333
3373337373
3373773333
3377333337
3733333737
3733377333
3737333733
7333373733
7333733337
7337733333
7373333373
7733373333

 Posted by Charlie on 2006-04-09 23:53:36 Please log in:

 Search: Search body:
Forums (1)