I need soln. of this prb.

Sorry @sulochana8041 but I don’t know what the pattern is please write the pattern like +1 -2 +10 and then I’ll try to help you.

@sulochana8041
For the given problem, i can see the patter being 2N, 2N-8 on repeat.

Hey @codechief1 but from 64-50 in is -14.

i=14
k=28
n=1
while(i<=50):
  print(i)
  print(k)
  k=k+12*n
  i=i+6*n
  n=n+1

Notice alternate elements for pattern

1 Like

Hey @abhinav_singh1 nice :ok_hand:

the pattern is 14,20,32,50 at odd places which will be at 0th 2nd and so on indices.
So, find them through a[i]= base+6*(i/2). Take base as 14 in beginning and update it after finding a[i].

then for elements on 1st 3rd and other odd indices, they are simply 2*a[i-1].

dry code:
i=0; base=14;
while base<50:
a[i]=base+6*(i/2);
a[i+1]=2*a[i];
base=a[i];
i+=2;

this is the logic rest is syntax