⌊ 2 0 1 7 1 2 ⌋ , ⌊ 2 0 1 7 2 2 ⌋ , ⌊ 2 0 1 7 3 2 ⌋ , … , ⌊ 2 0 1 7 2 0 1 7 2 ⌋
How many distinct numbers are there in the list of numbers above?
Notation:
⌊
⋅
⌋
denotes the
floor function
.
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.
Note, essentially there are two types of counting: for the numbers greater or equal to 1009, the solution notes each term is unique, so is counting the number of terms in the sequence in that span .
For the numbers less than or equal to 1008, the solution looks at the actual values of the floors instead, and notes every value from 0 to 503 must be included, so is counting based on the actual values of the terms .
Can someone please explain what the question is asking for? I'm reading the question and solutions and still not understanding how you mean "distinct numbers" in this context.
Log in to reply
Distinct numbers would be ones where none of them in the set are equal. The floor(1.4) and floor(1.5) are both 1 so they are not distinct numbers.
I have cleaned up the notation in the solution for the author, and added a clarifying note.
I assume that when Pavneet is using the value n, he is referring to the numerator in the series so that the series represents all floor functions [n^2/2017]. This function does not reach 1 until n = 45, reaches 2 when n = 64, reaches 3 at n = 78, and the numbers naturally get closer as n gets larger, but at n = 503, a number singled out by P., the value of the floor function is 125, since [503^2/2017] = 125.438... What I am saying is that as n increases from 1 to 503, the floor numbers from 1 to 125 are generated. Either I don't understand the problem, but the conclusion seems at variance with the result. Can't the problem be worded as to ask how many unique floor values are contained in the series as n goes from 1 to 2017? Ed Gray
Log in to reply
I believe what is being said is that for integers less than 1009, the spacing between the function being evaluated is less than one. Therefore, every number less than 2 0 1 7 1 0 0 8 2 ≈ 5 0 3 . 7 5 will have at least one instance in the series. The number of integers from 0 to 503 is 504. From 1009 on, because the spacing is larger than one, every value used will produce a unique number in the series. There are 1009 numbers left for 1009-2017, so 1009 + 504 = 1513.
Could you please make it more legible? It is very hard to follow. Thanks
To Bradlee, we need to clear up what we are referring to when we talk about integers and function. I assume that by integers, we mean the numerators in the floor function [n^2/2017].Note that this function has the value 0 until we reach n= 45, since 45^2/2017 = 1.0003966287.. It does not reach 2 until n = 64 since 64^2/2017 = 2.030738721, so you can see that the solutions start out sparse. A solution is defined whenever the function hits a new integer as we increase from 1,2,3,..... As a matter of interest, when n = 503, we have n =125 since 503^2/2017 = 125.4382747. When n = 1009, we have 1009^2/2017 = 503.75, as agreed by all; however, the solutions below this are not every integer, but are quite sparse, settling down to every other integer or so, not every integer. I think I have shown that the first 44 integers produce 0 as the value of the floor function. If I am correct, I believe the real answer if we reach an understanding what the problem is would be considerably less than that given. Someone with a computer should have a relatively easy time of it. Ed Gray
I'll add one more comment. There seems to be agreement that because numbers are have a spacing less than 1, they have different floor numbers. On the contrary, the floor number is the largest integer less than a given number. It would follow that numbers close together would all have the same floor number until the argument got large enough to produce the next highest integer for the floor number. I have already pointed out that n^2/2017 is < 1 for n < 45. Hence for 1 < n < 45, the floor number is 0 which is the largest integer less than or equal to n^2/2017. I will bore you no more. Thanks for reading. Ed Gray
Jason, I find the explanation confusing, especially for the lower part of the spectrum. The problem asks for unique floor values, and you say that for values less than 503, since the values of [n^2/2017] < 1,all should be included, but the floor value is 0 until we get to the 45th term, then becomes 1, stays there until n is in the 60's, and there are only 4 distinct floor values in the first 100 terms.. I am missing something and I apologize. In any case, keep trying. Ed Gray
Log in to reply
Suppose you have a sequence that decrements by 0.7, starting from 10: 10.0, 9.3, 8.6, 7.9, 7.2, 6.5, 5.8, 5.1, 4.4, 3.7, 3.0, 2.3, 1.6, 0.9, 0.2
Converting these into the floors 10, 9, 8,7, 6, 5, 5, 4, 3, 3, 2, 1, 0, 0 removing the duplicates: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 so all values from 10 to 0 are included.
I'm guessing your confusion might be you are removing both duplicates. We still can count a distinct value 5 from the example set, just we can't count both of them because the set won't consist solely of distinct integers any more.
For a number "n", at what point does the consecutive square divided by a number "y" become at least 2y? Is it fluke or theory that it was the value rounded up from 2017/2 ? And how did he know absolutely that each number afterwards would yield at least some k*2017?
I've written the following program in Pyth :
K2017l{m/^d2KSK
You can try it online here . Note that Pyth is a golfing language, and its aim is to make programs as short as possible.
How does it work?
K2017l{m/^d2KSK - Full program.
K2017 - Assign 2017 to a variable K.
m SK - Map over the range [1, K], with a preassigned variable d.
^d2 - Square d.
/ K - Integer division with K.
{ - Remove duplicate elements.
l - Length.
- Print the result implicitly.
Oh my! Why do you want to solve a problem using a golfing language?
Good job, though
The lazy solution (python3):
len(set(x*x//2017 for x in range(1, 2018)))
Explanation (also valid code):
1 2 3 4 5 6 7 8 9 |
|
Haha, this is a quick solution.
How would you generalise this method, though? What if the bounds were large?
2 0 1 7 = 4 4 . 9 which means that ⌊ x 2 / 2 0 1 7 ⌋ = 0 if 0 ≤ x ≤ 4 4
2 0 1 7 ∗ 2 = 6 3 . 5 which means that ⌊ x 2 / 2 0 1 7 ⌋ ≤ 1 if 0 ≤ x ≤ 6 3 , which also means that there is 2 distinct numbersin the sequence up to x=63 (which are 0 and 1).
Now the fun part:
2 0 1 7 ∗ 5 0 0 = 1 0 0 4 . 2 4 and 2 0 1 7 ∗ 5 0 1 = 1 0 0 5 . 2 4 , this means that for x>=1005 every number in the sequence is unique.
Since 2 0 1 7 ∗ 5 0 0 = 1 0 0 4 . 2 4 we know there exist 500 unique numbers(including 0) for 0 ≤ x ≤ 1 0 0 4
The entire sequence contains 500+2017-1004=1513 unique numbers.
We Need to be careful in our counting process; for example, the numbers 555,588,573 are not the floor of any [n^2/2017. Ed Gray]
Log in to reply
My solution try to find a value x=floor(n^2/2017) such that all x'>=x has at most one value n for which it is true(not multiple values it is the floor of), and all x'<x has at least one value n for which the formula is true (they are the floor of).
If I find that x and n, then for all values n'>n the function floor(n'^2/2017) will give a unique value. So we count all the x' which are smaller than x, because they all are the floor for some n. And we count all the n'>=n because they all generate a unique floor.
x=500, n=1004.
I hope this helps clarify how we do not count numbers which are not the floor of any n^2/2017 :)
1 2 3 4 5 |
|
1 2 |
|
1513
Alternate python 2.7 two-liner
One-liner in Python2.7:
print len({i**2/2017 for i in xrange(1,2018)})
Php code solution
1 2 3 4 5 6 7 8 |
|
Problem Loading...
Note Loading...
Set Loading...
Relevant wiki: Floor Function
⇔ ⇔ ⇔ ⇔ 2 0 1 7 n 2 − 2 0 1 7 ( n − 1 ) 2 2 0 1 7 n 2 − ( n 2 + 1 − 2 n ) 2 0 1 7 2 n − 1 2 n − 1 n ≥ 1 ≥ 1 ≥ 1 ≥ 2 0 1 7 ≥ 1 0 0 9
From above, when n ≥ 1 0 0 9 its difference of a value from its previous value is greater then 1. Therefore the floor function will have a unique value when n ≥ 1 0 0 9 . The total number of values for this case is ( 2 0 1 7 − 1 0 0 9 ) + 1 = 1 0 0 9 .
Conversely, when n ≤ 1 0 0 8 , then the difference between consecutive values is less than 1, hence we will obtain every integer in that range. Since ⌊ 2 0 1 7 1 0 0 8 2 ⌋ = 5 0 3 , each value from 0 to 503 will be obtained so there are 504 unique values.
This means the total number of unique values is 1 0 0 9 + 5 0 4 = 1 5 1 3 .