Public submissions
Source code of every submission to this problem in this contest will be visible for everyone since 4012-10-16 21:00:00.

NUMSERIE - NUMBER SERIES

A number series 1, 2, 3, 4, 6, 9, 13... is generated using the formula t[n] = t[n - 1] + t[n - 3].

Print the first 100 terms in the series.

Input

None

Output

Print the first 100 terms in the series one per line

Example

Output:
1
2
3
4
6
...
(100 terms)

Added by:cegprakash
Date:2012-10-12
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ADA95 ASM32 GAWK C CSHARP C++ 4.3.2 CPP14-CLANG C99 CLPS CLOJURE LISP sbcl LISP clisp D-CLANG ERL FSHARP FORTRAN GO HASK ICON ICK JS-RHINO JS-MONKEY LUA NICE NIM NODEJS OCAML PAS-FPC PERL PERL6 PHP PICO PIKE PRLG-swi PYTHON PYPY PYTHON3 RUBY SCM guile SCM qobi SED TCL VB.NET WHITESPACE
Public source code since: 4012-10-16 21:00:00

hide comments
2014-03-11 08:15:25 cegprakash
If your code compiles on ideone.com, it will compile here as well.
2013-02-27 15:25:19 Sanjay
what is the syntax for header files in C++(g++ 4.0.08
2013-02-22 10:15:48 ashish kumar gupta
what is error in this?? No idea??/Please tell..


#include<iostream>

using namespace std;

long long int i1 = 1, i2 = 2, i3 = 3;

int main()
{
int i = 1;

cout << i1 << endl << i2 <<endl << i3 << endl;
i = i + 3;

while(i < 100)
{
long long int i4 = i3 + i1;
cout << i4 << endl;
++i;

long long int i5 = i4 + i2;
cout << i5 << endl;
++i;

i1 = i3;

i2 = i4;

i3 = i5;
}
cout << i3+i1 <<endl;

}
2012-10-16 14:53:06 cegprakash
For those who are getting compilation error, click on the "compilation error" to know what error you made
2012-10-16 14:50:37 cegprakash
The answer will fit in long long in C/C++ and long in Java
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.