#Code done in Dr. Z.'s Experimental Math Class, Spring 2016, Jan. 21, 206 Help:=proc() : print(` IsPerfect(n) , PerfectL(N) ,coin() `) : print(` Game(N) , Mer(N), Hn(n) , JL(n)`): end: with(numtheory): IsPerfect:=proc(n) evalb(sigma(n)=2*n): end: #PerfectL(N): the list of all the perfect numbers <=N PerfectL:=proc(N) local n,L: L:=[]: for n from 1 to N do if IsPerfect(n) then L:=[op(L), n]: fi: od: L: end: #coin(): tossing a coin, outputs 1 or -1 with prob. 1/2 coin:=proc() : 2*rand(0..1)()-1: end: #Game(N): you toss a fair coin N times and see how much you won #or lost Game:=proc(N) local i: add(coin(),i=1..N): end: #Mer(N):Mertens(N): the sum of mobius(i) from i=1 to i=N Mer:=proc(N) local i: add(mobius(i), i=1..N): end: #Hn(n): the Harmonic numbers Hn:=proc(n) local i: add(1/i,i=1..n): end: #JL(n): JL:=proc(n) evalf(Hn(n)+exp(Hn(n))*log(Hn(n))-sigma(n),20): end: