login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A329249
Starting from n: as long as the decimal representation starts with an odd number, multiply the largest such prefix by 2; a(n) corresponds to the final value.
2
0, 2, 2, 6, 4, 20, 6, 24, 8, 28, 20, 22, 22, 26, 24, 60, 26, 64, 28, 68, 20, 42, 22, 46, 24, 200, 26, 204, 28, 208, 60, 62, 62, 66, 64, 240, 66, 244, 68, 248, 40, 82, 42, 86, 44, 280, 46, 284, 48, 288, 200, 202, 202, 206, 204, 220, 206, 224, 208, 228, 60, 222
OFFSET
0,2
COMMENTS
As long as we have a number whose decimal representation is the concatenation of odd number, say u, and a possibly empty string of even digits allowing leading zeros, say v, we replace this number with the concatenation of u*2 and v; eventually only even digits remain.
LINKS
FORMULA
a(n) >= n with equality iff n belongs to A014263.
a(2*n+1) = a(4*n+2).
a(10*k + v) = 10*a(k) + v for any k >= 0 and v in {0, 2, 4, 6, 8}.
a(5^k) = 2*10^k for any k >= 0 (the ratio a(n)/n is unbounded).
EXAMPLE
For n = 127:
- 127 gives 127*2 = 254,
- 254 gives 25*2 followed by 4 = 504,
- 504 gives 5*2 followed by 04 = 1004,
- 1004 gives 1*2 followed by 004 = 2004,
- 2004 has only even digits, so a(127) = 2004.
MATHEMATICA
{0}~Join~Array[FixedPoint[If[AllTrue[#, EvenQ], FromDigits@ #, FromDigits@ Flatten@ Join[2 IntegerDigits@ FromDigits[First[#]], Last[#]] &@ TakeDrop[#, Position[#, _?OddQ][[-1, -1]] ] ] &@ IntegerDigits[#] &, #] &, 61] (* Michael De Vlieger, Dec 01 2019 *)
PROG
(PARI) a(n) = if (n==0, 0, n%2, a(2*n), 10*a(n\10)+(n%10))
CROSSREFS
See A327539 for similar sequences.
Cf. A014263.
Sequence in context: A365380 A005992 A085050 * A067045 A083467 A061807
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Nov 30 2019
STATUS
approved