Let n be an integer randomly chosen in the interval [ 1 , 1 2 0 ] , and consider the sum S n = k = 1 ∑ n k .
S n is least likely to be divisible by __________ .
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.
n | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | ... | Pattern | Probability |
∑ i = 1 n | 1 | 3 | 6 | 10 | 15 | 21 | 28 | 36 | 45 | 55 | 66 | 78 | 91 | 105 | 120 | 136 | ... | ||
Divisible by 2 ? | (x | x | o | o) | (x | x | o | o) | (x | x | o | o) | (x | x | o | o) | ... | Repeated every 4 numbers | 4 2 = 2 1 |
Divisible by 3 ? | (x | o | o) | (x | o | o) | (x | o | o) | (x | o | o) | (x | o | o) | (x | ... | Repeated every 3 numbers | 3 2 |
Divisible by 4 ? | (x | x | x | x | x | x | o | o) | (x | x | x | x | x | x | o | o) | ... | Repeated every 8 numbers | 8 2 = 4 1 |
Divisible by 5 ? | (x | x | x | o | o) | (x | x | x | o | o) | (x | x | x | o | o) | (x | ... | Repeated every 5 numbers | 5 2 |
How does one show that this pattern continues?
Why isn't 5 preferred over 4?
The question is just-- sum of n natural nose,, now for consecutive numbers,, to check if divisible by a no. We check blocks of that no. Like for 2 we take 2 no in a block, similarly 3 for 3, 4 for 4.
So for the sum,, probabilty in a block for sum to be multiple, For 2 probabilty is 1/2=50% For 3=> 1/3 =33.33/ For 4 = 1/4 =25% For 5= 2/5 =40% ((1+2+3+4 divisible by5, 1+2+3+4+5 divisible by 5))
Thus, lowest probability is for 4.
Relevant wiki: Sum of n, n², or n³
Note that
S = i = 1 ∑ n i = 2 n ( n + 1 )
Note that n , n + 1 are relatively prime to each other. Let d = p k be a prime power that divides S (which is true for all four options in the problem). Suppose 2 d = a b , such that a divides n and b divides n + 1 . We divide into two cases:
The conclusion is that if p is odd, then one of n , n + 1 must be divisible by d , while if p is even, then one of n , n + 1 must be divisible by 2 d . It's easy to see that if these conditions are satisfied, then indeed S is divisible by d .
Since n , n + 1 is relatively prime, if we pick n uniformly at random, n is divisible by m with probability m 1 and n + 1 is divisible by m with probability m 1 , and the two cannot happen simultaneously. Thus S is divisible by m with probability m 2 . For odd d , pick m = d , while for even d , pick m = 2 d , as above. Since we pick n from the range [ 1 , 1 2 0 ] , we indeed have " n is divisible by d " being a uniformly random event for d = 2 , 3 , 4 , 5 (since 2 , 3 , 4 , 5 divide 120). This gives the following:
Thus 4 has the smallest probability.
Does this pattern tend to some limiting behaviour when the interval is made arbitrarily large?
Log in to reply
Yes; the probabilities tend to the same values as above.
Relevant wiki: Sum of n, n², or n³
Theorem:
S j n , j n − 1 ≡ 0 ( m o d m ) for odd n
S 2 j n , 2 j n − 1 ≡ 0 ( m o d n ) for even n
for a range of n in which n , j ∈ Z +
Proof:
Let n = 2 k − 1 , k ∈ Z + :
⇒ S n = S 2 k − 1 = 2 ( 2 k − 1 ) 2 k = k ( 2 k − 1 ) ≡ 0 ( m o d 2 k − 1 )
This congruence (i.e when S n ≡ 0 ( m o d 2 k − 1 ) ) occurs every consecutive 2 k − 1 . So, for every j ⋅ ( 2 k − 1 ) where j ∈ Z + :
S j ( 2 k − 1 ) ≡ 0 ( m o d 2 k − 1 )
or in terms of odd n :
S j n ≡ 0 ( m o d n )
Let n = 2 k , k ∈ Z + :
⇒ S n = S 2 k = 2 2 k ( 2 k + 1 ) = k ( 2 k + 1 ) ≡ k ( m o d 2 k )
Here, S 2 k ≡ 0 ( m o d 2 k ) doesn't occur every consecutive 2 k . Rather, it occurs every 2 consecutive 2 k i.e every 4 k ( This is in order to add another k for obtaining S m ≡ 0 ( m o d 2 k ) . Observing that S 4 k = 2 k ( 4 k + 1 ) ≡ 0 ( m o d 2 k ) ). So, for every j ⋅ 4 k where j ∈ Z + :
S 4 k j ≡ 0 ( m o d 2 k )
or in terms of n :
S 2 j n ≡ 0 ( m o d n )
Now for both odd and even cases, there could be additional cases when any of the n − i where i ∈ { 1 , 2 , 3 , . . . , n − 1 } can actually yields 0 ( m o d n ) . We will need to check for what values of i will this happen.
We have S n − i is the sum that we will need to comment on (an integer n ∈ [ 1 , 1 2 0 ] )
S n − i = 2 ( n − i ) ( n − i + 1 )
If n is even, then we have the case for even n :
2 ( 2 k − i ) ( 2 k − i + 1 ) m o d 2 k = − ( 2 i ) ( 1 − i )
We wanted to see when it is divisible by m = 2 k so we set:
− ( 2 i ) ( 1 − i ) = 0 ⇒ i = 0 , 1
Doing this to the case when n is odd gives the same result, hence, the conclusion is:
S j n , j n − 1 ≡ 0 ( m o d n ) for odd n
S 2 j n , 2 j n − 1 ≡ 0 ( m o d n ) for even n
We can use this to find probabilities of S n ≡ 0 ( m o d n ) , by finding how much of S n is divisible by n in the range n ∈ [ 1 , 1 2 0 ] :
All numbers n such that S n is divisible by 2 are: - P ( 2 ) = 1 2 0 S 4 j = 1 2 0 + S 4 j − 1 = 1 2 0 = 6 0 3 0 = 2 1
All numbers n such that S n is divisible by 3 are: - P ( 3 ) = 1 2 0 S 3 j = 1 2 0 + S 3 j − 1 = 1 2 0 = 1 2 0 8 0 = 3 2
All numbers n such that S n is divisible by 4 are: - P ( 4 ) = 1 2 0 S 8 j = 1 2 0 + S 8 j − 1 = 1 2 0 = 4 1
All numbers n such that S n is divisible by 5 are: - P ( 5 ) = 1 2 0 S 5 j = 1 2 0 + S 5 j − 1 = 1 2 0 = 6 0 2 4 = 5 2
It can be seen that P ( 4 ) is the lowest probability. Therefore, 4 is least divisible by S n for n ∈ [ 1 , 1 2 0 ]
Incorrect; S n is least likely divisible by, among others, 64, 121, 125, 127, 128, and many more other positive integers, all with probability 0. And in fact, S n is more likely to be divisible by 120 (probability 3/120) than it is divisible by 32 (probability 2/120).
Your fault is because you only consider numbers divisible by m . For example, when m = 3 , you only consider n = 3 , 6 , 9 , 1 2 , … and not n = 2 , 5 , 8 , 1 1 , … (where S n is also divisible by m ).
Log in to reply
Thanks for pointing that out. I will fix it in my solution
NOTE: This isn't an explanation, just a program.
Program written in Crystal to illustrate results:
1 2 3 4 5 6 7 8 9 10 |
|
I am not familiar with Crystal. Is it a new programming language?
Log in to reply
Yep, it's a programming language with Ruby-like syntax and is compiled. Here's a link.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
I added your code to the solution
Is using python to bruteforce a legitimate way to solve this problem? If so:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
1 |
|
where B[n] is the amount of numbers diviseble by n+2:
1 |
|
And yes! The idea was most likeley to solve the problem and show a mathematical proof, but writing a bit of code also solves the problem, be it in another way.
What if the interval was really large?
You can do augmented assignment for arrays as well -
A += ...
is valid Python.
Problem Loading...
Note Loading...
Set Loading...