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.
%I A322250 #43 Mar 27 2022 18:01:13 %S A322250 1,1,2,1,4,2,6,1,8,4,10,2,12,6,14,1,16,8,18,4,20,10,22,2,24,12,26,6, %T A322250 28,14,30,1,32,16,34,8,36,18,38,4,40,20,42,10,44,22,46,2,48,24,50,12, %U A322250 52,26,54,6,56,28,58,14,60,30,62,1,64 %N A322250 Take binary expansion of 2n-1 and delete the trailing block of 1's, except if the number is 11...1, leave a single 1. %C A322250 This is a fractal sequence because removing the first occurrence of each number in the sequence will leave the original sequence behind. %C A322250 One can repeat this process and always get back the original sequence, i.e., this sequence contains itself an infinite number of times. This is equivalent to removing the odd-indexed entries and getting back the original sequence. %C A322250 Fractal sequence listing the smallest positive ancestor of the odd positive integers, where ancestor(n) = (n-1)/2 if n>1 is odd or n if n is 1 or even. %H A322250 Antti Karttunen, <a href="/A322250/b322250.txt">Table of n, a(n) for n = 1..16384</a> %H A322250 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A322250 a(n) = A000265(n)-1, unless A000265(n) = 1 in which case a(n) = 1. %F A322250 a(n) = if n is 1 then 1, else if n is odd then n-1, else a(n/2). %F A322250 a(n) = max(1, A153733(n-1)). - _Rémy Sigrist_, Dec 01 2018 %e A322250 a(3) = 2 because the 3rd odd integer 5 equals 101 in binary, and removing the least significant consecutive 1's gives us 10 in binary = 2 in decimal. %e A322250 a(4) = 1 because the 4th odd integer 7 equals 111 in binary, and removing all except the initial 1 gives us 1 in binary = 1 in decimal. %e A322250 a(5) = 4 because the 5th odd integer 9 equals 1001 in binary, and removing the least significant consecutive 1's gives us 100 in binary = 4 in decimal. %e A322250 a(6) = 2 because the 6th odd integer 11 equals 1011 in binary, and removing the least significant consecutive 1's gives us 10 in binary = 2 in decimal. %t A322250 f[n_] := n/2^IntegerExponent[n, 2]; a[n_] := Module[{f1=f[n]}, If[f1==1, 1, f1-1]]; Array[a, 60] (* _Amiram Eldar_, Dec 01 2018 *) %o A322250 (PARI) print_list(n)={my(i);for(i=1,n,print1(max(1,i>>valuation(i,2)-1),","));} %o A322250 (PARI) a(n)={max(1, n>>valuation(n,2)-1)} \\ _Andrew Howroyd_, Dec 01 2018 %o A322250 (Python) %o A322250 def print_list(n): %o A322250 for i in range(1,n,2): %o A322250 z=i %o A322250 while z>1 and z%2 == 1: %o A322250 z = (z-1)/2 %o A322250 print(z) %o A322250 def a(n): %o A322250 z = 2*n - 1 %o A322250 while z>1 and z%2 == 1: %o A322250 z = (z-1)/2 %o A322250 print(z) %o A322250 (Python) %o A322250 def A322250(n): %o A322250 s = bin(2*n-1)[2:].rstrip('1') %o A322250 return int(s,2) if s != '' else 1 # _Chai Wah Wu_, Jan 02 2019 %Y A322250 Cf. A000265, A153733. %K A322250 nonn,base %O A322250 1,3 %A A322250 _David Cleaver_, Nov 30 2018