201 positive integers are written.?
OK this is a really cool problem, although its just weird to use 19999 at both ends why not use 20,000? Also, you made it seem like there was only one solution, and there are actually quite a few possible solutions perhaps you meant to ask for the smallest possible sum? Anyway, since there are going to be 199 numbers to sum, and the constrain about numbers having to be less than the average of its nearest neighbors makes me thing that the numbers could get big as we go, so lets start out by looking at what happens if we set the second number to 1. If it is 1, then the next number can be 2, because the average of 2 and 19999 is WAY bigger than 1. Now, for the next number, we see that it has to be 4 or larger since if it were 3, then (1+3)/2=2, and the third number being 2 is too large. So now our sequence is starting to take shape, and looks like: 19999,1,2,4, Since we can now see how the sequence grows from there, lets get rid of the 19999 (and the one at the end) and just see how this continues. It looks like: 1,2,4,7,11,16,22,29,37,46,56,67, Just as a curiosity at this point, lets see what the running total looks like as we sum this sequence: 1,3,7,14,25,41,63,92, So now we stop to see whether anything looks familiar. And we notice that the first sequence looks a lot like the Triangle numbers, which is the third diagonal of Pascals Triangle. The Triangle numbers go ,1,3,6,10,15,21,28,, which are each just one less than the numbers we found for our sequence. So now we look at the second sequence and we see that the running total is just the Pyramidal Numbers (which is the fourth diagonal of Pascals Triangle) with n added. That is, since the first sequence has a 1 added to each number, the running total has an n added, where n is the term of the sequence were looking at. OK so lets figure out exactly what we need to figure out the formula for the summing sequence. Terms of Pascals Triangle are usually of the form N!/(x!(N-x)!). In this case, though, it looks like we start offset by one term because the fourth term 14, which means we are looking for 144, or 10, and we know from experience doing these sorts of problems that 10 is often found as 5!/(3!2!). So lets do a little testing to see, and well take the 7th term, which is 63, and subtract 7 to get 56 (looks promising). If we take 8!/(3!5!) we get 56! Great I think we have everything we need now, since we know that we need the 199th term of the summing sequence, we get 200!/(3!197!), and that is 1,313,400. To this we need to add 199 (for all the extra 1s we needed along the way), and 39,998 (for the first and last 19999s). We get 1,353,597. Now, just to be sure that we didnt screw up, lets look at the 198th and 199th terms of the actual number sequence in the numbers we were supposed to write between the 19999s. We get them by similar factorial fractions, which are 199!/(2!197!) + 1 = 19,702 198!/(2!196!) + 1 = 19,504 Since 19,702 is much less than (19,504+19,999)/2 = 19751.5, we are all good except that last number could have also been 19,703, 19,704, 19,705, all the way up to 19,751. And we could have used that flex in the system to change other numbers too so I dont believe this is entirely unique, but a damned fun problem nontheless!