#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int n = atoi(argv[1]); unsigned long R[n]; R[0] = 1;
if (n > 1) {
R[1] = 3; int S = 2; int P = 1;
for (int i = 1; i < n; i++) {
R[i] = R[i - 1] + S;
++S == R[P] && S++;
R[P] < S && P++;
}
}
for (int i = 0; i < n; i++) {
printf("%lu\n", R[i]);
}
}
edit: forgot to include stdio and stdlib :)