OFFSET
1,3
COMMENTS
Conjecture: gcd(n, m) = a(2^n + 2^m - 2) for n > 0 and m > 0. - Velin Yanev, Aug 24 2017
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
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
# Alternative:
N:= 200: # for a(1)..a(N)
V:= Vector(N, 1):
for k from 2 to ilog2(N) do
t:= 2^k-1;
V[[seq(i, i=t..N, t)]]:= k
od:
convert(V, list); # Robert Israel, May 12 2020
MATHEMATICA
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Leroy Quet, Jun 19 2009
EXTENSIONS
Extended by R. J. Mathar, Jun 27 2009
STATUS
approved