Tuesday, October 14, 2025

A389240 - A contribution to the On-Line Encyclopedia of Integer Sequences (OEIS)

This new sequence was just published today. I was happy to collaborate with my friend and fellow Illinois Tech alumnus and swimmer, Michael De Vlieger.

A389240

Start the sequence S with S(1) = n and extend S with S(m+1) = S(m)/2 when S(m) is even, otherwise with S(m) + the smallest odd number not yet added. a(n) is the number of steps to reach 1, or -1 if 1 is never reached.
0
0, 1, 3, 2, 8, 4, 4, 3, 6, 9, 9, 5, 33, 5, 5, 4, 9, 7, 7, 10, -1, 10, 10, 6, 7, 34, 34, 6, 13, 6, 6, 5, 34, 10, 10, 8, 9, 8, 8, 11, 10, -1, -1, 11, 11, 11, 11, 7, -1, 8, 8, 35, 34, 35, 35, 7, 8, 14, 14, 7, 96, 7, 7, 6, 14, 35, 35, 11, -1, 11, 11, 9, 35, 10, 10
OFFSET
1,3
COMMENTS
For n = 1, S begins 1, 2, 1, 4, 2. The subsequent terms are A066070.
FORMULA
a(2^k) = k.
a(2^k-1) = k+1 for k > 1.
a(2^k-2) = k+1 for k > 2.
For odd m and a(m) = h, a(2^k*m) = h+k.
EXAMPLE
For n = 5, S begins 5, 6, 3, 6, 3, 8, 4, 2, 1, thus 8 steps to reach 1, so a(5) = 8.
For n = 21, S begins 21, 22, 11, 14, 7, 12, 6, 3, 10, 5, 14, 7, 18, 9. Starting with the 7th step, 3, alternating terms of S are the odd numbers 3, 5, 7, 9..., so the sequence never reaches 1; a(21) = -1.
MATHEMATICA
Table[m = -1;
If[#[[-1]] == 1, -1 + Length[#], -1] &@
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, 75}]
CROSSREFS
KEYWORD
sign,new
AUTHOR
STATUS
approved

Top Five Dutch Mathematicians

Identifying the top five Dutch mathematicians involves evaluating their contributions to mathematics, focusing on impact, innovation, and re...

Popular in last 30 days