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 A101279 #35 Mar 07 2023 22:09:41 %S A101279 1,1,1,1,2,1,3,1,4,2,5,1,6,3,7,1,8,4,9,2,10,5,11,1,12,6,13,3,14,7,15, %T A101279 1,16,8,17,4,18,9,19,2,20,10,21,5,22,11,23,1,24,12,25,6,26,13,27,3,28, %U A101279 14,29,7,30,15,31,1,32,16,33,8,34,17,35,4,36,18,37,9,38,19,39,2,40,20,41,10 %N A101279 a(1) = 1; a(2k) = a(k), a(2k+1) = k. %C A101279 From _Jeremy Gardiner_, Mar 22 2015: (Start) %C A101279 For n > 2 write n, n-1 in binary, then align bits from the left and take contiguous matching bits as a binary number. %C A101279 For example: %C A101279 n = 19 10011 %C A101279 n-1 = 18 10010 %C A101279 a(n) = 9 1001 %C A101279 Also arrange the positive integers as a binary tree rooted at 1 as shown: %C A101279 1 %C A101279 | %C A101279 2................../ \..................3 %C A101279 | | %C A101279 4......../ \........5 6......../ \........7 %C A101279 / \ / \ / \ / \ %C A101279 / \ / \ / \ / \ %C A101279 / \ / \ / \ / \ %C A101279 8 9 10 11 12 13 14 15 %C A101279 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 %C A101279 Each branch doubles the number above at the left fork or doubles and adds 1 at the right fork. Then for n > 2, a(n) is the greatest common ancestor of n and n-1, a(n) = gca(n,n-1). %C A101279 (End) %C A101279 From _David James Sycamore_, Mar 07 2023: (Start) %C A101279 The following identical sequences, {b(n)} and {c(n)}, are the same as a(n+1) for n >= 1. %C A101279 b(1) = 1, then reverse the conditions in Name: b(2k) = k, b(2k+1) = b(k). %C A101279 c(1) = 1, then if c(n) is a first occurrence, c(n+1) = c(c(n)), else if c(n) has occurred previously, c(n+1) = n - c(n-1). %C A101279 These are fractal sequences (b(2m+1) = c(2m+1), m >= 1, recovers the originals). Also {b(n)} and {c(n)} interleave A000027 with the present sequence. %C A101279 (End) %H A101279 G. C. Greubel, <a href="/A101279/b101279.txt">Table of n, a(n) for n = 1..1000</a> %F A101279 a((n+1)/2) = A028310(n) if n is odd and a(n/2) = a(n) if n is even; thus this is a fractal sequence. - _Robert G. Wilson v_, May 23 2006; corrected by _Clark Kimberling_, Jul 07 2007 %F A101279 a(n) = A025480(n) + A036987(n) = (n/2^A007814(n) - 1)/2 + (n == 2^A007814(n)). - _Ralf Stephan_, Aug 21 2013 %F A101279 If n is a power of 2, A070939(a(n)) = 1, otherwise A070939(a(n)) = A119387(n-1). %F A101279 Numbers m for which a(m) = 1 are A000079(m) and A007283(m), a(2^m + 1) = 2^(m-1); m >= 1. - _David James Sycamore_, Mar 07 2023 %e A101279 If n is a power of 2 then k=1. %p A101279 a:=array(0..200); a[1]:=1; M:=200; for n from 2 to M do if n mod 2 = 1 then a[n]:=(n-1)/2; else a[n]:=a[n/2]; fi; od: [seq(a[n],n=1..M)]; %t A101279 a[1] = 1; a[n_] := a[n] = If[OddQ@n, (n - 1)/2, a[n/2]]; Array[a, 84] (* _Robert G. Wilson v_, May 23 2006 *) %o A101279 (PARI) a(n)=(n/2^valuation(n,2)-1)/2+if(n==2^valuation(n,2),1,0) /* _Ralf Stephan_, Aug 21 2013 */ %Y A101279 Cf. A003602, A025480. %Y A101279 cf. A000027, A000079, A007283, A070939, A119387. - _David James Sycamore_, Mar 07 2023 %K A101279 nonn %O A101279 1,5 %A A101279 _N. J. A. Sloane_, May 22 2006; definition corrected May 23 2006