restart:with(numtheory): # formula for efficiency eff := (p,a) -> evalf[30](ln(sigma(p^a)/p^a)/ln(p^a)): # forbidden factors x := 4*127*19*7*11*331*97*61*31*13*398581*1093*3*5*307*17: # finding the smallest exponent "a" such that gcd(sigma(p^a), x) = 1 n := 0: for p from 3 to 10000 by 2 do if gcd(p,x) = 1 and isprime(p) then a := 1; while gcd(sigma(p^a), x) > 2 do a := a+1; od; n := n+1; t[n] := (p,a,eff(p,a)); fi; od; # sorting by efficiency for i from 1 to n do im := i; for j from i+1 to n do if t[j][3] > t[im][3] then im := j; fi; od; m := t[im]; t[im] := t[i]; t[i] := m; od: # computing the product of components with highest efficiency while abundancy < 2 abun := 1: prod := 1: for i from 1 while abun*(1+1/(t[i][1]-1)) < 2 do abun := abun*(1+1/(t[i][1]-1)); prod := prod*t[i][1]^t[i][2]; od: print(evalf(abun), evalf(log[10](prod))); ### result: 1.997859878, 1735.673672