Find the number of distinct values of this expression:
⌊N/4⌋ - ⌊N/7⌋ - ⌊N/14⌋ - ⌊N/28⌋
Notes:
1) ⌊x⌋ is the floor of x, which is the greatest integer less than or equal to x.
2) Adapted from a problem appearing in Singapore Mathematical Olympiad, Junior 2022.
Let Q = Floor( N/28 ). Then we can write N = 28Q + A, where 0 <= A < 28.
Define F = Floor( N/4) - Floor( N/7) - Floor( N/14 ) - Floor( N/28). Then
F = ( 7Q + Floor( A/4) ) - (4Q + Floor( A/7) )- (2Q + Floor( A/14) ) - (Q + Floor( A/28) )
= Floor( A/4) - Floor( A/7) - Floor( A/14) - Floor( A/28)
So F can take on at most 28 values, corresponding to A taking on integer values between 0 and 27.
As A increases, F can change values only when we reach a multiple of 4, 7 or 14.
We see that
When A = 0, 1, 2, or 3, F is given by 0
When A = 4, 5, or 6, F is given by 1
When A = 7, F is given by 0
When A = 8, 9, 10, or 11, F is given by 1
When A = 12 or 13, F is given by 2
When A is 14 or 15, F is given by 0
When A is 16, 17, 18 or 19, F is given by 1
When A is 20, F is given by 2
When A is 21, 22 or 23, F is given by 1
When A is 24, 25, 26, or 27, F is given by 2
Hence, the only values F can take on are 0, 1 and 2, that is, three possible values
Edited on June 6, 2023, 4:57 pm
|
Posted by FrankM
on 2023-06-06 16:53:10 |