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 A161789 #33 Jun 30 2025 04:26:00 %S A161789 1,1,2,1,1,2,3,1,2,1,1,2,1,3,4,1,1,2,1,1,3,1,1,2,1,1,2,3,1,4,5,1,2,1, %T A161789 3,2,1,1,2,1,1,3,1,1,4,1,1,2,3,1,2,1,1,2,1,3,2,1,1,4,1,5,6,1,1,2,1,1, %U A161789 2,3,1,2,1,1,4,1,3,2,1,1,2,1,1,3,1,1,2,1,1,4,3,1,5,1,1,2,1,3,2,1,1,2,1,1,4 %N A161789 a(n) is the largest integer k such that 2^k - 1 divides n. %C A161789 The sums of the first 10^k terms, for k = 1, 2, ..., are 15, 183, 1898, 19219, 192464, 1924900, 19249110, 192491275, 1924913468, 19249135108, ... . Apparently, the asymptotic mean of this sequence is 1.924913... . - _Amiram Eldar_, Jun 30 2025 %H A161789 Robert Israel, <a href="/A161789/b161789.txt">Table of n, a(n) for n = 1..10000</a> %F A161789 A161788(n) = 2^a(n) - 1. %F A161789 a(A161790(n)) = 1. %F A161789 Conjecture: gcd(n, m) = a(2^n + 2^m - 2) for n > 0 and m > 0. - _Velin Yanev_, Aug 24 2017 %p A161789 A161789 := proc(n) for k from ilog2(n+1) to 0 by -1 do if n mod (2^k-1) = 0 then RETURN(k); fi; od: end: seq(A161789(n),n=1..120) ; # _R. J. Mathar_, Jun 27 2009 %p A161789 # Alternative: %p A161789 N:= 200: # for a(1)..a(N) %p A161789 V:= Vector(N,1): %p A161789 for k from 2 to ilog2(N) do %p A161789 t:= 2^k-1; %p A161789 V[[seq(i,i=t..N,t)]]:= k %p A161789 od: %p A161789 convert(V,list); # _Robert Israel_, May 12 2020 %t A161789 kn[n_]:=Module[{k=Floor[Log[2,n]]+1},While[!Divisible[n,2^k-1],k--];k]; Array[kn,110] (* _Harvey P. Dale_, Mar 26 2012 *) %o A161789 (PARI) a(n)=forstep(k=logint(n+1,2),1,-1, if(n%(2^k-1)==0, return(k))) \\ _Charles R Greathouse IV_, Aug 25 2017 %Y A161789 Cf. A000225, A161788, A161790. %K A161789 nonn,easy %O A161789 1,3 %A A161789 _Leroy Quet_, Jun 19 2009 %E A161789 Extended by _R. J. Mathar_, Jun 27 2009