Consider a sequence u where u is defined as follows:
- The number
u(0) = 1is the first one inu. - For each
xinu, theny = 2 * x + 1andz = 3 * x + 1must be inutoo. - There are no other numbers in
u.
Ex:
u = [1, 3, 4, 7, 9, 10, 13, 15, 19, 21, 22, 27, ...]
1 gives 3 and 4, then 3 gives 7 and 10, 4 gives 9 and 13, then 7 gives 15 and 22 and so on...
Given parameter n the function dbl_linear (or dblLinear...) returns the element u(n) of
the ordered (with <) sequence u (so, there are no duplicates).
dbl_linear(10) should return 22
Focus attention on efficiency