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

Home > Numbers
Staggered divisibility (Posted on 2013-09-16) Difficulty: 3 of 5
The number, 1406357289, is a pandigital number (i.e. containing all of the digits - 0 to 9 - once, in some order), but it also has a rather interesting sub-string divisibility property.
Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we note the following:

d2d3d4=406 is divisible by 2
d3d4d5=063 is divisible by 3
d4d5d6=635 is divisible by 5
d5d6d7=357 is divisible by 7
d6d7d8=572 is divisible by 11
d7d8d9=728 is divisible by 13
d8d9d10=289 is divisible by 17

Find the sum of all pandigital numbers with this property.

Source: Euler Project.

No Solution Yet Submitted by Ady TZIDON    
No Rating

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

DEFDBL A-Z
CLS
FOR d4 = 0 TO 8 STEP 2
  used(d4) = 1
FOR d6 = 0 TO 5 STEP 5
 IF used(d6) = 0 THEN
  used(d6) = 1
FOR d1 = 1 TO 9
 IF used(d1) = 0 THEN
  used(d1) = 1
FOR d2 = 0 TO 9
 IF used(d2) = 0 THEN
  used(d2) = 1
FOR d3 = 0 TO 9
 IF used(d3) = 0 THEN
  used(d3) = 1
FOR d5 = 0 TO 9
 div3 = 100 * d3 + 10 * d4 + d5
 IF used(d5) = 0 AND div3 MOD 3 = 0 THEN
  used(d5) = 1
FOR d7 = 0 TO 9
 div7 = 100 * d5 + 10 * d6 + d7
 IF used(d7) = 0 AND div7 MOD 7 = 0 THEN
  used(d7) = 1
FOR d8 = 0 TO 9
 div11 = 100 * d6 + 10 * d7 + d8
 IF used(d8) = 0 AND div11 MOD 11 = 0 THEN
  used(d8) = 1
FOR d9 = 0 TO 9
 div13 = 100 * d7 + 10 * d8 + d9
 IF used(d9) = 0 AND div13 MOD 13 = 0 THEN
  used(d9) = 1
FOR d10 = 0 TO 9
 div17 = 100 * d8 + 10 * d9 + d10
 IF used(d10) = 0 AND div17 MOD 17 = 0 THEN
  used(d10) = 1

  PRINT d1; d2; d3; d4; d5; d6; d7; d8; d9; d10

  used(d10) = 0
 END IF
NEXT
  used(d9) = 0
 END IF
NEXT
  used(d8) = 0
 END IF
NEXT
  used(d7) = 0
 END IF
NEXT
  used(d5) = 0
 END IF
NEXT
  used(d3) = 0
 END IF
NEXT
  used(d2) = 0
 END IF
NEXT
  used(d1) = 0
 END IF
NEXT
  used(d6) = 0
 END IF
NEXT
  used(d4) = 0
NEXT

The results, sorted are:

1406357289
1430952867
1460357289
4106357289
4130952867
4160357289

The sum is  16695334890.


  Posted by Charlie on 2013-09-16 11:51:44
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (15)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information