How to print this pattern | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to print this pattern

1 2 15 3 4 5 66 6 7 8 9 10 189 11 12 13

7th Jul 2019, 2:39 AM
sushmitha R
2 Answers
+ 15
you must be having problem for middle column, for that you can make a method to find sum of elements of both sides of middle column & multiply it with 3 to form middle column element(for 1st row it will be 1) alternatively, middle term will be given by 3n*(2n^2+3) [valid from 2nd row(n=1), except for n=0(1st row) it is 1]
7th Jul 2019, 6:20 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
middle num = (first + last) * 3 * line (I am not sure if its 3 because n = 3 or if you always start with 3) 2 + 3 = 5 5 * 3 * 1 = 15 4 + 7 = 11 11 * 3 * 2 = 66 8 + 13 = 21 21 * 3 * 3 = 189
7th Jul 2019, 3:40 PM
Denise Roßberg
Denise Roßberg - avatar