What are the last three digits of the 1 0 0 0 0 th non-triangular natural number?
A triangular number is one of the form 2 n ( n + 1 ) for some positive integer n .
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.
It can be proved that the sequence that just misses the triangular numbers is given by a n = [ n + 2 n ]
where [x] is the greatest integer function.
I believe you are mistaken. Your formula hits 4 triangular numbers in the first 16 terms! a 4 = 6 , a 7 = 1 0 , a 1 1 = 1 5 , a 1 6 = 2 1 - Maybe something is missing.
After consulting OEIS, I think a better candidate for your sequence is: a n = n + ⌊ . 5 + 2 n ⌋
Using this sequence formula the solution to the problem is simple: a 1 0 0 0 0 = 1 0 0 0 0 + ⌊ . 5 + 2 0 0 0 0 ⌋ = 1 0 0 0 0 + 1 4 1 = 1 0 1 4 1
The last 3 digits are 1 4 1 The FloorFunction piece "rounds to the nearest integer" instead of just chopping off the fractional part. Without the rounding tweak, the formula hits some triangular numbers like a 4 = 6 as your formula did. With rounding, a 4 = 7 and you 'dodge' the triangular number 6.
I wrote a program to solve this
Problem Loading...
Note Loading...
Set Loading...
We can use the Principle of Inclusion-Exclusion or just PIE. There are 10000 natural numbers that we're going to sort through. For each triangular number that we find, it's going to increase the 10000th non-trianglular number by 1 (convince yourself this is true). To illustrate what I mean, consider the following example:
Let's look at the first few triangular numbers. They are 1, 3, 6, 10, 15, etc. Think about it like this. We have listed:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
As of now, our desired answer is 10, since we haven't found any triangular numbers. If we realize that 1 is indeed a triangular number, our list becomes
2, 3, 4, 5, 6, 7, 8, 9, 10, 11
Notice how because we found that one, the desired answer (the 10th non-triangular number) has increased by 1. If we realized that 3 is another triangular number, our list becomes
2, 4, 5, 6, 7, 8, 9, 10, 11, 12
Which again raises our answer by 1. Eliminating 6 and 10, we get
2, 4, 5, 7, 8, 9, 11, 12, 13, 14
And thus our desired answer is 1 4 for this problem.
Do you notice anything about our answer? It's the number of terms we're considering (which is 10) plus the number of triangular numbers less than or equal to 10 (which is 4).
Can we apply this to our problem here?
Let's try. We'll first set 2 n ( n + 1 ) equal to 10000. Solving produces
n ≈ 1 4 0 . 9 2 , − 1 4 1 . 9 2
Which means that there are 140 triangular numbers beneath 10000. So our answer would just be the last three digits of 1 0 0 0 0 + 1 4 0 which is 140, right?
Wrong. Remember how in our example the answer was 14? Well, if there had been one more triangular number, the answer would have changed to 15, which is triangular and would make the result 16 instead! This isn't the case, obviously, but it is for 10000. So let's plug in 141. This produces 2 ( 1 4 1 ) ( 1 4 1 + 1 ) . That's 10011! Because the answer that we got before was 10140, this is another one we have to count since it's less than 10140, which raises our answer to 10141! Let's check the next highest case, 142. If this is above 10141, we're set and our answer is 141. Indeed, plugging this into the expression produces 10153, which is larger than 10141 and thus isn't counted.
Thus our final answer is 1 4 1 . @Walker Anderson I saw that you had marked this problem as "Solution-Free", so I posted one for you. Thanks for being awesome! :D