In Memory of Denis Roskin
Input:
pair.in Description
Denis Roskin, Jr. has come up with an interesting mathematical series in memory of his late father,
Dr. Denis Roskin, Sr., the long forgotten mathematician who died at the age of 40. Actually,
Jr. came up with two (rather coupled) series, which he named
The Denis Roskin Pair or DR for short. Each is defined as follows:
The Denis Series
D
(0) = 1 D
(i) = i
Xk=1R(i - k) k
where i > 0 The Roskin Series
R
(0) = 1 R
(i) = i
-1 Xk=0D(k) i
- k where i > 0. where
bxc is the floor of x and dxe is the ceiling of x. The first 10 elements in the series are: index:
i 0 1 2 3 4 5 6 7 8 9 Denis Series:
D(i) 1 1 1 2 4 6 11 17 29 47 Roskin Series:
R(i) 1 1 2 3 5 8 12 20 30 49 Write a program to compute the Denis Series.
Input Format
Your program will be tested on a number of test cases. The input is made of one or more integers
v
i terminated by a -1 (which is not part of the test cases.) Each integer appears on a separate line. Note that 0
vi 40 (remember: Dr. Denis Roskin died at the age of 40). Output Format
For each
vi in the input, write on a separate line, the value of D(vi). Sample Input/Output
pair.in
1
5
9
-1
OUTPUT
1
6
47