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

Home > Just Math
Prime divisors (Posted on 2005-01-04) Difficulty: 3 of 5
6300846559 is such that 6 is divisible by 2; 63, by 3; 630, by 5; 6300, by 7; and, in general, if you take its first N digits, it will be divisible by the N-th prime.

There is only one other such 10 digit number: can you find it?

See The Solution Submitted by e.g.    
Rating: 3.7500 (4 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Short program | Comment 3 of 11 |
The following gawk script runs in 0.04 seconds in my Linux machine, and produces 0000000000, 6300846559, and 8757193191
BEGIN {

for (a=0; a<10; a++) if (check(a,2)) {
for (b=0; b<10; b++) if (check(a b,3)) {
for (c=0; c<10; c++) if (check(a b c,5)) {
for (d=0; d<10; d++) if (check(a b c d,7)) {
for (e=0; e<10; e++) if (check(a b c d e,11)) {
for (f=0; f<10; f++) if (check(a b c d e f,13)) {
for (g=0; g<10; g++) if (check(a b c d e f g,17)) {
for (h=0; h<10; h++) if (check(a b c d e f g h,19)) {
for (i=0; i<10; i++) if (check(a b c d e f g h i,23)) {
for (j=0; j<10; j++) if (check(a b c d e f g h i j,29)) {
print a b c d e f g h i j;
}
}
}
}
}
}
}
}
}
}
}

function check(nnn,pp) {
nnn += 0
return ((nnn % pp) == 0);
} Edited on January 4, 2005, 5:24 pm
  Posted by Federico Kereki on 2005-01-04 17:19:47
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 (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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