# HW 2 # OK to post Help := proc(): print(`binomCoeff(n), nopsTest(n)`): end: # outputs the binomial coefficients of N-th degree binomCoeff := proc(N) local s,j, i,y: s:= 1: if N<0 then RETURN(FAIL): fi: if N=0 then #not sure how to return multiple lines yet RETURN(s): fi: for i from 1 to N do s := 0,s,0; y := seq(s[j]+s[j+1], j=1..i+1): s:= y: od: y: end: nops([1,2,4]); nops([2,780]); nopsTest := proc(N): nops([binomCoeff(N)]); end: M:= table([ january = 1, february = 2, march = 3, april = 4, may = 5, june = 6, july = 7, august = 8, september = 9, october = 10, november = 11, december = 12 ]); M[january]; M[march]; M[december]; type(M, table); type([binomCoeff(3)],list); with(NumberTheory): # Euler Theorem verification (exercise 1) gcd(10^90,10^90-1); a:=10^90; n:=10^90 - 1; a&^phi(n) mod n; # Exercise 2 p:=ithprime(10^3); q:=ithprime(10^4+28); n:=p*q; e:=ithprime(10^5+29); gcd(phi(n),e); d:=e&^(-1) mod phi(n);