cài đặt phép cộng trên Fb
vd: P=2147483647; W=8; a=2147483646; b= 2147483643
Yêu cầu:
- In biểu diễn ma trận của p
- In kết quả a+b theo tt cộng chính xác bội và giá trị bit nhớ
- In kết quả cộng trên trường Fp
cài đặt thuật toán trừ trên Fp
Ví dụ1: p=2147483647; W=8; a=1387624979; b= 1568424364
VD2:p=433494437, a= 333294897, b= 183494999
VD3: p= 433494437, a=233294897, b= 383494999
Yêu cầu:
- In kết quả của phép trừ chính xác bội
In kết quả của phép trừ trên Fp
Bài 6: Cài đặt chương trình tính phép nhân
Ví dụ 1: p=2147483647; W=8; a=524647; b= 32549
Ví dụ 2: p=2147483647; W=8; a=2348762; b= 98637
06/01/2023 23:10
The program to calculate the multiplication on Fp can be installed as follows:
Example 1:
def multiplication(a, b): result = a * b if result > p: result = result - p return result