0
$\begingroup$

enter image description here

 Clear["Global`*"]
 G[s_] := Sort[DeleteDuplicates[Select[Flatten[Table[1/Round[(2^s)/m], {m, 1, 2^s}]],Between[#, {0, 1}] &]]]          
 f[x_] := Piecewise[{{Log[1/x], PrimeQ[1/x]}}, x]
 Averagef[s_] := Averagef[s] = N[Mean[Table[Simplify[f[G[s][[x]]]], {x, 1, Length[G[s]]}]]]

I want to find values of Averagef[s_] for larger values of s.

The problem is I'm unable to calculate Averagef[s_] past s=16

How do we improve my code to calculate Averagef[s_] for larger values of s? Does the limit of Averagef[s_] exist as s approaches infinity?

$\endgroup$
5
  • $\begingroup$ It might be easier if you define $f$ in terms of $m$ instead of $x = 1/m$. But it looks hard, because I'm not sure whether Mathematica can analyze (mathematically) the condition in the definition of $f$ — maybe there's someone here or at WRI who knows. You might have to do some of the mathematics yourself. $\endgroup$
    – Michael E2
    Dec 28 '21 at 18:30
  • $\begingroup$ Are you missing a Mean in the definition of Averagef, or is it supposed to return a list of varying length? $\endgroup$
    – Michael E2
    Dec 28 '21 at 18:34
  • $\begingroup$ @MichaelE2 Oops. Fixed it. $\endgroup$
    – Arbuja
    Dec 28 '21 at 18:36
  • $\begingroup$ @MichaelE2 What does WRI stand for? $\endgroup$
    – Arbuja
    Dec 28 '21 at 18:45
  • 1
    $\begingroup$ Wolfram Research Inc., the maker of Mathematica. $\endgroup$
    – Michael E2
    Dec 28 '21 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.