Page 1 of 1

### 927 - Integer Sequences from Addition of Terms

Posted: Tue Jun 12, 2007 3:28 pm .. I don't understand the question 927.... how find 'n'... Somebody can help me???????
Thanks!!!!!!!!

Posted: Sun Jul 29, 2007 1:42 pm
Donte:

If an=n^2, and d=3 then the first terms of bm are:
1, 1, 1, 4, 4, 4, 4, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9 , 9, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 25, 25, ...

For k=1 you have to print 1.
For k=2 you have to print 1.
For k=3 you have to print 1.
For k=4 you have to print 4.
For k=9 you have to print 4.
For k=10 you have to print 9.
For k=23 you have to give 16.

### Re: 927 - Integer Sequences from Addition of Terms

Posted: Thu Jun 19, 2014 2:31 pm
Here's some input / output I found useful during testing / debugging.

Please note that these were taken directly from
http://saicheems.wordpress.com/2013/07/ ... -of-terms/
and all credit goes to this person.

Input:

Code: Select all

``````12
4 3 0 0 0 23
25
100
1 0 1
1
6
3 0 1 5 7
7
43
3 0 1 5 7
7
1
3 0 1 5 7
7
16
3 0 1 5 7
7
42
3 0 1 5 7
7
7
3 0 1 5 7
7
1000000
5 1 1 1 1 1 1
1
1000000
20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
100000
1000000
1 1 1
2
1000000
20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
1
21
``````
AC Output:

Code: Select all

``````1866
3
532
13
78
237
13
1073344285
5656584705361395
1466015503701
1001
3656158440062976
``````

### Re: 927 - Integer Sequences from Addition of Terms

Posted: Tue May 12, 2015 1:14 pm
v1n1t, can you please explain some of your given input output? I didn't understand the input and output.

for example, how the output is 1866 for the following input ?
4 3 0 0 0 23
25
100

I think the proble statement is not clear enough. It should be modified !

### Re: 927 - Integer Sequences from Addition of Terms

Posted: Sat Dec 19, 2015 11:42 am
I'll attempt to explain the problem clearer as the given explanation was very confusing and it took me a long time to understand.

If d = 1 then the sequence is
1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, .....
with each successive integer having one additional term.

Similarly if d = 2 then the sequence is
1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, .....
Given the original sequence the number of terms for each integer is multiplied by d. To find the kth term of this sequence simply count to that many terms. For example k = 5 results in 2 in the above sequence, as the 5th term is a 2.

Now for that part that I found to be explained poorly. The first line of each case describes a polynomial that you substitute the kth term into. However the first number in this line is not part of the polynomial, instead it describes the highest power in the polynomial.

For example, in the sample input line '4 3 0 0 0 23', the 4 means that the polynomial goes up to x^4. The following numbers then describe the polynomial in increasing powers.
In the given example, the polynomial is:
3(x^0) + 0(x^1) + 0(x^2) + 0(x^3) + 23(x^4)
The x value represents the previously found kth term. So if the kth term was found to be 3, as it is in the first sample input, you would evaluate the polynomial to
3(3^0) + 0(3^1) + 0(3^2) + 0(3^3) + 23(3^4) = 1866, the correct sample output.

Hope this clears the question up for people.