Thanks everyone who shed light on the problem. Especially to jonnin. I'm sorry for being mix up with 115 and 155 and having noticed it. One number confused all system
Hmm. There's a closed-form expression, in fact. Done by tracing back the dependencies in my iterative formula. However, there must be a quicker argument for choosing n from 2n ...
vn = 2nCn
e.g.
v1 = 2C1 = 2
v2 = 4C2 = 6
v3 = 6C3 = 20
etc.
The ratio of successive terms is vn/vn-1 = 2(2n-1)/n
1 2 3 4 5 6 7 8 9 10 11 12
#include <iostream>
usingnamespace std;
int main()
{
unsignedlonglong v = 1;
for ( int n = 1; n <= 31; n++ ) // overflow danger for higher
{
v = v * 2 * ( 2 * n - 1 ) / n;
cout << "v" << n << ": " << v << '\n';
}
}