Can anyone help me with Spiral Numbers from Dementia 2012 - IIT Mandi Contest?

Hello friends can someone tell me how to approach this problem ??

@vijju123 @kaushal101 @mohit_negi @taran_1407 @vivek_1998299 @meooow @john_smith_3

Analyze the pattern. Here, it seems that difference between 2 consecutive results is :

N_{i + 1} - N_{i} = 8i + 1 \quad \forall \quad i >= 0 \quad; \quad N_0 = 0

Use this to come up with formula for N_i.
I came up with this quadratic formula:

(4i - 7)(i - 1)

https://www.codechef.com/viewsolution/18244780

2 Likes

Thanks for your efforts :slight_smile: Could you explain how did you get that quadratic equation ?

On using summation on RHS I came up with 4ii+5*i+1 as the answer.

@harrypotter0 tbh I was really sleepy when I came up with the equation so I can’t remember the exact procedure I went through. To come up with an equation for n^{th} term:

Let a function f(x) = 8x + 1

Then, N_1 = f(0) , \quad N_2 = f(0) + f(1) and so on
So N_i = \sum_{n=0}^{i-1} f(i)

Use sum of n terms to get a formula:

N_i = 8(0 + 1 + 2 + ... + (i-1)) + (1 + 1 + ...(i\quad times)... + 1)

N_i = i(4i - 3)

My equation is just for (i - 1)^{th} term instead of i^{th} term.

1 Like

@harrypotter0 I forgot to add that your expression gives (i + 1)^{th} term, otherwise its same… :smiley:

1 Like

@fr4nkesti3n I got it now thanks :slight_smile:

1 Like