How many possible 6 digit numbers are there of the form N = a b c a b d where a = 0 , d = 0 , d = c + 1 and N is a perfect square?
Details and assumptions
The condition of
a
=
0
follows because we have a 6 digit number.
The condition of
d
=
0
follows because
0
=
9
+
1
.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
1 minor detail was left out. What is missing?
Log in to reply
Is it that mod 1001, there's no more than one possibility for n in each case, because 3 1 7 ≤ n < 1 0 0 0 if N has 6 digits?
Log in to reply
I've no idea what you are trying to say (specifically how 317 came in).
It can be shown that N ≡ d − c ( m o d 1 0 0 1 ) , where N satisfies the conditions of the question.
It is true that for any integer (not nec 6 digits ), then the remainder when n is divided by 1001 is uniquely determined.
Log in to reply
@Calvin Lin – As N = n 2 , 3 1 7 = ⌈ 1 0 6 ⌉ so that N has 6 digits.
What I was trying to say is that if n ≡ 1 5 5 (mod 1001), as in case (2) for example, then n is not necessarily 155, but can be 1156, 2157, and so on. But as n < 1 0 0 0 , we now that all n + k ⋅ 1 0 0 1 will be to big and we don't have to check them.
As this part was not in the solution above, I thought maybe it was the minor detail that you said was left out. It is quite obvious though, so I'm really not sure what you thought was left out :)
Log in to reply
@Laurent Shorts – Ah yes. I was going for " n ≤ 1 0 0 0 " as the restriction to explain why we don't have to care about (say) n = 1 0 0 2 .
Using the condition of 3 1 7 ≤ n ≤ 9 9 9 makes it very easy to do the proper checking :)
Thanks for clarifying!
If N = a b c a b d = M 2 , then M 2 − 1 = 1 0 0 1 × a b c , and hence M 2 − 1 is divisible by 1 0 0 1 = 7 × 1 1 × 1 3 . Since 1 0 0 0 0 0 ≤ N < 1 0 0 0 0 0 0 , we deduce that 3 1 6 < M < 1 0 0 0 . There are eight cases to consider (omitting the details of the Chinese Remainder Theorem calculations):
If M ≡ 1 modulo 7 , 1 1 , 1 3 , then M ≡ 1 modulo 1 0 0 1 , and no such M exists in the desired range.
If M ≡ 1 modulo 7 , 1 1 , and M ≡ − 1 modulo 1 3 , then M ≡ 1 5 5 modulo 1 0 0 1 , and so no M exists in the desired range.
If M ≡ 1 modulo 7 , 1 3 and M ≡ − 1 modulo 1 1 , then M ≡ 2 7 4 modulo 1 0 0 1 , and so no M exists in the desired range.
If M ≡ 1 modulo 1 1 , 1 3 and M ≡ − 1 modulo 7 then M ≡ 5 7 3 modulo 1 0 0 1 , so that M = 5 7 3 and N = 3 2 8 3 2 9 .
If M ≡ 1 modulo 7 and M ≡ − 1 modulo 1 1 , 1 3 , then M ≡ − 5 7 3 modulo 1 0 0 1 , so that M = 4 2 8 and N = 1 8 3 1 8 4 .
If M ≡ 1 modulo 1 1 and M ≡ − 1 modulo 7 , 1 3 , then M ≡ − 2 7 4 modulo 1 0 0 1 , so that M = 7 2 7 and N = 5 2 8 5 2 9 .
If M ≡ 1 modulo 1 3 and M ≡ − 1 modulo 7 , 1 1 , then M ≡ − 1 5 5 modulo 1 0 0 1 , so that M = 8 4 6 and N = 7 1 5 7 1 6 .
If M ≡ − 1 modulo 7 , 1 1 , 1 3 then M ≡ − 1 modulo 1 0 0 1 , and so no M exists in the desired range.
Thus there are just 4 numbers N of the desired type.
This problem appeared in British Mathematical Olympiad 1993 Round 1.
hate "case-uistics", here's a java proggie for that.
public class DigitsABCABD {
private static boolean isPerfectSquare(long input) {
long root = (long) Math.sqrt(input);
return ((root * root) == input);
}
public static void main(String[] args) {
int resultsFound = 0;
for (int a=1; a <= 9; a++) {
for (int b=0; b <= 9; b++) {
for (int c=0; c <= 9; c++) {
int d = c+1;
try {
String NStr = String.valueOf(a) +
String.valueOf(b) +
String.valueOf(c) +
String.valueOf(a) +
String.valueOf(b) +
String.valueOf(d);
int N = Integer.parseInt(NStr);
if (isPerfectSquare(N)) {
resultsFound++;
System.out.println("Found " + N + ", total " + resultsFound);
}
} catch (Exception e) {
System.err.println(e);
}
}
}
}
}
}
Found 183184, total 1
Found 328329, total 2
Found 528529, total 3
Found 715716, total 4
Log in to reply
After failing to solve this mathematically, I also wrote a programme and it gave me the same results! I used Python instead. Programmers rock!! Keep up the good work!
Nice! Clean and clear, thanks for your great solution!!
Did the same.
N = a b c a b d = a b c a b c + 1 = a b c ( 1 0 0 1 ) + 1 .
Let N = n 2 , where n is a positive integer. Thus a b c ( 1 0 0 1 ) + 1 = n 2 or a b c ( 1 0 0 1 ) = n 2 − 1 = ( n − 1 ) ( n + 1 ) .
As 1 0 0 ≤ a b c ≤ 9 9 9 , so 1 0 0 ( 1 0 0 1 ) + 1 ≤ a b c ( 1 0 0 1 ) + 1 ≤ 9 9 9 ( 1 0 0 1 ) + 1 .
Thus 3 1 6 2 = 9 9 8 5 6 ≤ 1 0 0 1 0 1 ≤ n 2 ≤ 1 0 0 0 2 − 1 + 1 = 1 0 0 0 2
As n > 0 , 3 1 6 ≤ n ≤ 1 0 0 0 .
Consider a b c ( 1 0 0 1 ) = ( n − 1 ) ( n + 1 )
The prime factorisation of 1 0 0 1 = 7 ∗ 1 1 ∗ 1 3 . As n − 1 and n + 1 have difference 2, they cannot have common factor larger than 2. The equation above shows that the prime factors 7, 11 and 13 divide n − 1 or/and n + 1 .So 7, 11, 13 each divide only n − 1 or n + 1 .
It can be seen that 2 of the primes divide 1 of n − 1 and n + 1 while the last prime divides the other.
There are 3 cases. First, n − 1 or n + 1 is divisible by 1 1 ∗ 1 3 = 1 4 3 while the other is divisible by 7. Secondly, n − 1 or n + 1 is divisible by 7 ∗ 1 3 = 9 1 while the other is divisible by 11. Lastly, n − 1 or n + 1 is divisible by 7 ∗ 1 1 = 7 7 while the other is divisible by 13.
We have 3 1 5 ≤ n − 1 < n + 1 ≤ 1 0 0 1 . Thus we only need check the multiples of 143, 91 and 77 in this range and set them as n − 1 or n + 1 while checking whether the other of the pair passes the test of divisibility by the 3rd prime.
This yields ( n − 1 , n + 1 ) = ( 4 2 7 , 4 2 9 ) , ( 5 7 2 , 5 7 4 ) , ( 7 2 6 , 7 2 8 ) , ( 8 4 5 , 8 4 7 ) .
So
n
=
4
2
8
,
5
7
3
,
7
2
7
,
8
4
6
. From
a
b
c
(
1
0
0
1
)
=
n
2
−
1
, we obtain
a
b
c
=
1
0
0
1
n
2
−
1
. So
a
b
c
=
1
8
3
,
3
2
8
,
5
2
8
,
7
1
5
.
Therefore N = a b c a b d = 1 8 3 1 8 4 , 3 2 8 3 2 9 , 5 2 8 5 2 9 , 7 1 5 7 1 6 .
Based on my finding, I used up an hour to find the squared of from 3 1 7 to 9 9 9 . Since 1 0 0 0 0 0 = 3 1 6 . 2 2 7 7 6 6 0 1 6 . Among all 6 8 3 numbers, there are 6 perfect squares satisfy the following condition of a b c a b d . These numbers are...
4 2 8 2 = 1 8 3 1 8 4 5 4 8 2 = 3 0 0 3 0 4 5 7 3 2 = 3 2 8 3 2 9 7 2 7 2 = 5 2 8 5 2 9 8 4 6 2 = 7 1 5 7 1 6 8 5 6 2 = 7 3 2 7 3 6
Since d = c + 1 , 3 0 0 3 0 4 and 7 3 2 7 3 6 does not satisfy the following condition. Hence, there are 4 solutions.
You are really hardcore
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Let n : = a b c . With d = c + 1 , we can simplify the perfect square N : N = a b c a b c + 1 = 1 0 0 1 n + 1 = ! m 2 ⇒ 1 0 0 1 n = ( m + 1 ) ( m − 1 ) ∣ 1 0 0 1 = 7 ⋅ 1 1 ⋅ 1 3
Each of the prime factors of 1001 must divide one of the two factors on the right. If we collect the prime factors into p , q , respectively, we get a different diophantine equation to solve for each factorization of 1001: 1 0 0 1 = p q : m + 1 m − 1 = p x = q y } 2 = p x − q y , x , y ∈ Z ∣ ∣ m 2 − 1 = p q x y , n = 1 0 0 1 m 2 − 1 = x y
Notice the value of m 2 − 1 does not change if we switch the signs of both p , q , or if we interchange them: It is enough to consider factorizations of 1001 with 0 < p ≤ q . We are left with only four cases, and p , q are coprime in all of them:
p 1 7 1 1 1 3 q 1 0 0 1 1 4 3 9 1 7 7 2 = x − 1 0 0 1 y 2 = 7 x − 1 4 3 y 2 = 1 1 x − 9 1 y 2 = 1 3 x − 7 7 y ( ∗ ) ⇒ ⇒ ⇒ ⇒ ( x y ) = ( 1 0 1 0 0 1 1 ) ( 2 k ) , ( x y ) = ( 4 1 2 1 4 3 7 ) ( 2 k ) , ( x y ) = ( 2 5 3 9 1 1 1 ) ( 1 k ) , ( x y ) = ( 6 1 7 7 1 3 ) ( 2 k ) , k ∈ Z k ∈ Z k ∈ Z k ∈ Z n = x y ( 2 + 1 0 0 1 k ) k ( 8 2 + 1 4 3 k ) ( 4 + 7 k ) ( 2 5 + 9 1 k ) ( 3 + 1 1 k ) ( 1 2 + 7 7 k ) ( 2 + 1 3 k ) Our unknown number is restricted by n ∈ { 1 0 2 ; … ; 9 8 7 } . These restrictions determine which k we may choose. p 1 7 1 1 1 3 k − 1 0 − 1 − 1 n 1 8 3 3 2 8 5 2 8 7 1 5 N 1 8 3 1 8 4 3 2 8 3 2 9 5 2 8 5 2 9 7 1 5 7 1 6 ⇒ 4 distinct solutions! It's easy to see there are no other possibilities, because the parabolas x y all have both zeros and their global minimum in [ − 1 ; 0 ] .
Rem.: In ( ∗ ) , we use the solution for the general linear diophantine equation: p x − q y = r , p , q , r ∈ Z , g cd ( p , q ) = 1 ⇒ ( x y ) = ( x 0 y 0 q p ) ( r k ) , k ∈ Z
The pair ( x 0 , y 0 ) is any solution of p x 0 − q y 0 = 1 , obtained by Euclid's Algorithm or simply guessing. In the third row of the table, k was shifted to get the smallest non-negative solution at k = 0 .
N = 1 0 0 1 0 0 a + 1 0 0 1 0 b + 1 0 0 1 c + 1 . Let N = x 2 so that 3 1 6 < x < 1 0 0 0 and N − 1 = 1 0 0 1 ( 1 0 0 a + 1 0 b + c ) = ( x + 1 ) ( x − 1 ) . Since 1 0 0 1 = 7 × 1 1 × 1 3 we have
7 × 1 1 × 1 3 × ( 1 0 0 a + 1 0 b + c ) = ( x + 1 ) ( x − 1 )
Each prime factor must be a factor of either x + 1 or x − 1 . So, respecting the upper bound for x we cannot have them all in either x + 1 or x − 1 . There are six possible cases
So we have 4 solutions.
As an example for finding x I show the 3rd case below
x ≡ − 1 ( m o d 9 1 )
x = 9 0 + 9 1 t
x ≡ 2 + 3 t ( m o d 1 1 )
Also, x ≡ 1 ( m o d 1 1 )
3 t ≡ − 1 ≡ − 1 2 ( m o d 1 1 )
t ≡ − 4 ≡ 7 ( m o d 1 1 )
x = 9 0 + 9 1 × 7 = 7 2 7
N = x 2 = 5 2 8 5 2 9
Problem Loading...
Note Loading...
Set Loading...
Note that we can re-write N as N = 1 0 0 1 ( 1 0 0 a + 1 0 b + c ) + 1 . Let N = n 2 . We will look for solutions that work for n using modular arithmetic. Taking the equation mod 7, we get n 2 = 1 ( m o d 7 ) . Similarly we also have n 2 = 1 ( m o d 1 1 ) and n 2 = 1 ( m o d 1 3 ) . So we have a few cases to try. (Although there appears to be a lot of cases, several of them follow from others.):
1) n = 1 ( m o d 7 , 1 1 , 1 3 ) . In this case we see that there are no values of n that work where a>0, since n = 1 works and the Chinese Remainder Theorem tells us that this is the only solution (mod 7 11 13=1001). Hence there are no solutions in this case.
2) n = 1 (mod 7,11) and n = − 1 (mod 13). We quickly see that n=155. However, since 1 5 5 2 has less than 6 digits, we see that this case fails.
3) n = 1 (mod 7,13) and n = − 1 (mod 11). We can see that n=274. But similarly, 2 7 4 2 has less than 6 digits, and so this case fails too.
4) n = 1 (mod 11,13) and n = − 1 (mod 7). We see that n=573, and since 5 7 3 2 has 6 digits this number works.
5) n = − 1 (mod 7,11) and n = 1 (mod 13) Note that this is analogous to case 2, except for the fact that the sign of n is changed. Thus we quickly see that n = − 1 5 5 = 8 4 6 (mod 1001) works.
6) n = − 1 (mod 7,13) and n = 1 (mod 11). Similarly, we have n = − 2 7 4 = 7 2 7 (mod 1001).
7) n = − 1 (mod 11,13) and n = 1 (mod 7). Similarly, we have n = − 5 7 3 = 4 2 8 (mod 1001).
8) n = − 1 (mod 7,11,13) This simply yields n = 1 0 0 0 (mod 1001), which fails. Therefore, there are 4 total possible solutions.