6
8
9
12
15
20
22
30
I am comparing the first number with the others then the 2nd number with all the numbers below it etc.
For each comparison, I am looking if the two numbers are separated by less than 10 for example. Then I print all the numbers that respect this condition.
because I start from the beginning with 6 and the 'highest' value respecting the condition is 15 in this list. All numbers between 6 and 15 are ignored.
Same logic for 20 and 30 etc.
I tried to do something like that but it didn't go as expected.