cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A327539 Starting from n: as long as the decimal representation starts with a positive even number, divide the largest such prefix by 2; a(n) corresponds to the final value.

This page as a plain text file.
%I A327539 #35 Feb 28 2020 01:38:09
%S A327539 0,1,1,3,1,5,3,7,1,9,5,11,3,13,7,15,1,17,9,19,5,11,11,13,3,15,13,17,7,
%T A327539 19,15,31,1,33,17,35,9,37,19,39,5,11,11,13,11,15,13,17,3,19,15,51,13,
%U A327539 53,17,55,7,57,19,59,15,31,31,33,1,35,33,37,17,39,35,71
%N A327539 Starting from n: as long as the decimal representation starts with a positive even number, divide the largest such prefix by 2; a(n) corresponds to the final value.
%C A327539 For n > 0, as long as we have a number whose decimal representation is the concatenation of a positive even number, say u, and a possibly empty string of odd digits, say v, we replace this number with the concatenation of u/2 and v; eventually only odd digits remain.
%H A327539 Rémy Sigrist, <a href="/A327539/b327539.txt">Table of n, a(n) for n = 0..10000</a>
%H A327539 Rémy Sigrist, <a href="/A327539/a327539.png">Logarithmic scatterplot of the first 1000000 terms</a>
%H A327539 Rémy Sigrist, <a href="/A327539/a327539_1.png">Scatterplot of the ordinal transform of the first 1000000 terms</a>
%F A327539 a(n) <= n with equality iff n = 0 or n belongs to A014261.
%F A327539 a(2*n) = a(n).
%F A327539 a(10*k + v) = 10*a(k) + v for any k >= 0 and v in {1, 3, 5, 7, 9}.
%F A327539 a(n) = 1 iff n is a power of 2.
%F A327539 a(n) = 3 iff n belongs to A007283.
%F A327539 a(n) = 5 iff n belongs to A020714.
%F A327539 a(n) = 7 iff n belongs to A005009.
%F A327539 a(n) = 9 iff n belongs to A005010.
%F A327539 a(n) = a(n+1) iff n belongs to A215145.
%e A327539 For n = 10000:
%e A327539 - 10000 gives 10000/2 = 5000,
%e A327539 - 5000 gives 5000/2 = 2500,
%e A327539 - 2500 gives 2500/2 = 1250,
%e A327539 - 1250 gives 125/2 = 625,
%e A327539 - 625 gives 62/2 followed by 5 = 315,
%e A327539 - 315 has only odd digits, so a(10000) = 315.
%t A327539 Array[FixedPoint[If[AllTrue[#, OddQ], FromDigits@ #, FromDigits@ Flatten@ Join[IntegerDigitsFromDigits[First[#]]/2, Last[#]] &@ TakeDrop[#, Position[#, _?EvenQ][[-1, -1]] ] ] &@ IntegerDigits[#] &, #] &, 71] (* _Michael De Vlieger_, Dec 01 2019 *)
%o A327539 (PARI) a(n) = if (n==0, 0, n%2==0, a(n/2), 10*a(n\10)+(n%10))
%Y A327539 See A329249, A329424 and A329428 for similar sequences.
%Y A327539 Cf. A007283, A014261, A020714, A005009, A005010, A215145.
%K A327539 nonn,base,easy
%O A327539 0,4
%A A327539 _Rémy Sigrist_, Nov 29 2019