OFFSET
1,1
COMMENTS
Set S(j) = k for j = 1, thereafter, S(j+1) = S(j)/2 when S(j) is even, otherwise with S(j)+m, where m >= 1 is the smallest odd number not yet added.
This sequence concerns numbers k whose trajectories S(k) do not reach 1 under recursion.
One reason a trajectory for k never reaches 1 is if we see even S(j) = q, S(j+2) = q+4, and thus odd S(j+1) = q/2, S(j+3) = q/2 + 2, respectively. This is the means by which A389240(k) = -1 for k <= 2^23. Does another reason exist such that the trajectory of k never reaches 1?
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
EXAMPLE
For a(1) = k = 21, we start with S(1) = 21. Since 21 is odd S(2) = S(1)+1 = 22. S(2) is even, thus S(3) = S(2)/2 = 11, etc. Thus the trajectory of 21 is {21, 22, 11, 14, 7, 12, 6, 3, 10, 5, 14, 7, 18, 9, 22, 11, 26, 13, 30, 15, 34, 17, 38, 19, ...} and it becomes evident with alternating parity, etc., that the trajectory of 21 never reaches 1.
Table of n, a(n), and binary expansion of a(n), a(n)_2, where we replace 0s with "." to enhance pattern.
n a(n) a(n)_2
-------------------
1 21 1.1.1
2 42 1.1.1.
3 43 1.1.11
4 49 11...1
5 69 1...1.1
6 77 1..11.1
7 84 1.1.1..
8 86 1.1.11.
9 87 1.1.111
10 98 11...1.
11 99 11...11
12 105 11.1..1
13 138 1...1.1.
14 139 1...1.11
15 145 1..1...1
16 154 1..11.1.
MATHEMATICA
Reap[Do[m = -1;
If[#[[-1]] == 1, -1 + Length[#], Sow[n]] &@
If[n < 5,
NestWhileList[If[EvenQ[#], #/2, # + (m += 2)] &, n, # > 1 &],
NestWhileList[If[EvenQ[#], #/2, # + (m += 2)] &, n,
And[#4 > 1, Nand[#1 == #3 - 2, #2 == #4 - 4] ] &, 4] ],
{n, 400}] ][[-1, 1]]
CROSSREFS
KEYWORD
nonn
AUTHOR
Michael De Vlieger and James C. McMahon, Oct 15 2025
STATUS
approved
