# Please do not post homework # Vikrant, Apr 17 2022, Assignment 22 # ================================================================================ # 0. Code that has been given. # ================================================================================ read("C22.txt"): # ================================================================================ # 1. Show that alpha is the golden ratio assuming ai(i)=trunc(i*alpha). # ================================================================================ (* # The value of alpha must be unique. # That is, if ai(i)=trunc(i*alpha)=trunc(i*beta), then alpha=beta. # Why? # Let k be the first decimal position in which alpha differs from beta. # Then trunc(10^k*alpha)<>trunc(10^k*beta). # TODO. *) # ================================================================================ # 2. # ================================================================================ # ================================================================================ # 3. Read and understand LaG(G) and its subroutines. # ================================================================================ # Done. # ================================================================================ # 4. Losing positions. # ================================================================================ LpG:= proc(G) local os:= LaG(G): local i: {seq(`if`(os[i]=0,i,NULL),i=1..nops(G))}: end: # ================================================================================ # 5. Average size of losing positions given arc probability. # ================================================================================ AvNuLP:= proc(n,p,K) local i: evalf(add(nops(LpG(RDG(n,p))),i=1..K)/K): end: (* randomize(284766820): for n in [10,50,100] do for p in [1/5,2/5,3/5,4/5] do print(AvNuLP(n,p,10^5)); od: od: *)