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

#1

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

#2

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

#3

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

#4

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

#5

@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.

#6

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

@fr4nkesti3n I got it now thanks 