ex2 - Gap commands Each expresion finishes with an Modular...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Gap commands Each expresion finishes with an ; Modular arithmetic: Product, addition, subtraction, integer division and powers: gap> 3 gap> 96 gap> 507 gap> 294 gap> 1722 gap> 1722 gap> 261 gap> 1 gap> 6 gap> 5 gap> -1 gap> 2 gap> 8 2*3; 2+3; 2-3; 6/3; 2^3; Factors of a positive integer and prime numbers: gap> Factors(704); [ 2, 2, 2, 2, 2, 2, 11 ] gap> IsPrime(17); true gap> IsPrime(15); false 234 mod 7; ((4*31*4*6)+(4*9*25*3)) mod 1116; 2^96 mod 1117; (5^672) mod 2017; (5^672)^2 mod 2017; 294^2 mod 2017; 3^(-1) mod 391; 3*261 mod 391; Chinese Remainder Theorem; command ChineseRem( moduli, residues ) gap> ChineseRem( [ 2, 3, 5, 7 ], [ 1, 2, 3, 4 ] ); 53 gap> ChineseRem( [ 6, 10, 14 ], [ 1, 3, 5 ] ); 103 The MCD: Matrices (written as row vectors) gap> Gcd( 92,391); 23 Euler Phi function: gap> Phi(32); 16 Taking the integerpart of a k-th root (number, k): gap> RootInt(50653,3); 37 gap> 37^3; 50653 1 2 Example: 2 2 1 2 1 0 2 0 0 1 2 0 0 2 gap> mat:=[[1,1,2,2],[2,2,0,0],[2,1,0,0],[2,0,1,2]]; [ [ 1, 1, 2, 2 ], [ 2, 2, 0, 0 ], [ 2, 1, 0, 0 ], [ 2, 0, 1, 2 ] ] gap> Determinant(mat); -4 gap> Inverse(mat) mod 7; [ [ 0, 3, 1, 0 ], [ 0, 1, 6, 0 ], [ 1, 2, 2, 6 ], [ 3, 3, 5, 1 ] ] gap> Inverse(mat) mod 3; [ [ 0, 1, 1, 0 ], [ 0, 1, 2, 0 ], [ 1, 0, 2, 2 ], [ 1, 2, 1, 1 ] ] gap> To get out: quit; ...
View Full Document

This note was uploaded on 07/17/2011 for the course MAT 207 taught by Professor Bon during the Winter '10 term at Università della Calabria.

Ask a homework question - tutors are online