![enter image description here](https://i.stack.imgur.com/eQl7J.png)

here is my program i want to know is there any alternate mathematical logic to generate the result within 30 seconds upto a20132014th term ?

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

#include<conio.h>
long int *a,i,j,t;

int main()
{
    //clrscr();
    //printf("%ld",sizeof(long long  int));
    printf("\n Enter the number of terms: ");
    scanf("%ld",&t);

    a=(long int*)malloc(t*sizeof(long int));
    *(a+0)=0;
    printf("\na0=%5ld",*(a+0));
    for(i=1;i<=t;i++) {
        if(*(a+i-1)-i>0) {
            for(j=0;j<i;j++) {
                if(*(a+j)==*(a+i-1)-i)
                    goto Deepak;
            }
            *(a+i)=*(a+i-1)-i;
        }
        else
            Deepak:
        *(a+i)=*(a+i-1)+i;
        printf("\na%ld= %5ld",i,*(a+i));
    }
    //printf("\na%ld= %5ld",i,*(a+i));

    free(a);
    getch();
    return 0;
}

```