Question: I am new to linux. I have a folder with many files in it and i need to get the latest file depending on the file name. Example: I have 3 files `RAT_20190111.txt` `RAT_20190212.txt` `RAT_20190321.txt` . I need a linux command to move the latest file here `RAT20190321.txt` to a specific directory.

Answer: 
Sum of all numbers from 0 to n is 

> 
> n(a1+an)/2 = (in your case a1 = 0 and an = n+1) n\*(n+1)/2
> 
> 
> 

so the missing number is n\*(n+1)/2 - (sum of input numbers after the length)

```
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* v[]) {
    int length;
    int i = 0;
    int sum = 0;

    scanf_s("%d", &length);

    // calculate arithmetic series sum
    auto series_sum = ((length + 1) * (length)) / 2;

    while (i < length)
    {
        int next;
        scanf_s("%d", &next);

        sum += next;
        ++i;
    }

    printf("missing num is %d ", series_sum - sum);
}

```
You have `n` number of integers to be scanned. Use mathematical equation to calculate the [sum of first `n+1` natural numbers](https://en.wikipedia.org/wiki/1_%2B_2_%2B_3_%2B_4_%2B_%E2%8B%AF). Then run a loop for `n` times and then run a loop to add all the `n` numbers scanned. Then subtract this sum with the sum of `n+1` natural number. Result will be the missing number.