+ 1

Sequence of numbers pattern? Help please

What is the pattern behind this sequence of numbers: 1,1,2,3,3,4,5,5, ... I have to recursively generate the first n numbers of this sequence of numbers. Any help is appreciated. :)

13th Aug 2018, 3:53 PM
Filip German
Filip German - avatar
5 Answers
+ 4
Filip German the sequence is printed with a simple logic: if number is odd print number twice else print number once There now, hope it helps : )
13th Aug 2018, 5:21 PM
Ipang
+ 3
S. C. I understand that, but what is the formula for generating those numbers recursively in an array?
13th Aug 2018, 3:59 PM
Filip German
Filip German - avatar
+ 2
Ipang thanks :)
13th Aug 2018, 5:22 PM
Filip German
Filip German - avatar
+ 2
Filip German You're welcome, good luck : )
13th Aug 2018, 5:27 PM
Ipang
21st Jul 2020, 1:13 AM
shubham kumar
shubham kumar - avatar