p124 43

#include<stdio.h> 
void index(int x,int a[],int n) 

    int i,k; 
    for(i=0;i<n;i++) 
    { 
        printf("%d ",a[i]); 
    } 
printf("\n");
    for(i=0;i<n;i++) 
    { 
        if(x==a[i]) 
        { 
            k=1; 
            break; 
        } 
        else 
            k=0; 
    } 
    if(k==1) 
        printf("%d是其中一个数\n",x); 
    else 
        printf("%d不是其中一个数\n",x); 

int  main() 

    int i,a[100],n,x; 
    while(1) 
    { 
    printf("输入一个数\n"); 
    scanf("%d",&n); 
    printf("输入刚才输入的那么多个数\n"); 
    for(i=0;i<n;i++) 
    { 
        scanf("%d",&a[i]); 
    } 
    printf("输入一个数\n"); 
    scanf("%d",&x); 
    index(x,a,n); 
    } 
return 0; 

Yes, g = 3 is a generator for p = 179. To show that g is a generator, we need to verify that every integer between 1 and p-1 can be expressed as a power of g modulo p. In other words, we need to show that: g^0, g^1, g^2, ..., g^(p-2) are all distinct modulo p. For p = 179, we have: g^0 = 1 (mod 179) g^1 = 3 (mod 179) g^2 = 9 (mod 179) g^3 = 27 (mod 179) g^4 = 81 (mod 179) g^5 = 243 (mod 179) = 64 (mod 179) g^6 = 192 (mod 179) = 13 (mod 179) g^7 = 39 (mod 179) g^8 = 117 (mod 179) g^9 = 157 (mod 179) g^10 = 151 (mod 179) g^11 = 142 (mod 179) g^12 = 122 (mod 179) g^13 = 85 (mod 179) g^14 = 34 (mod 179) g^15 = 102 (mod 179) g^16 = 46 (mod 179) g^17 = 138 (mod 179) g^18 = 160 (mod 179) g^19 = 166 (mod 179) g^20 = 173 (mod 179) g^21 = 164 (mod 179) g^22 = 157 (mod 179) g^23 = 151 (mod 179) g^24 = 142 (mod 179) g^25 = 122 (mod 179) g^26 = 85 (mod 179) g^27 = 34 (mod 179) g^28 = 102 (mod 179) g^29 = 46 (mod 179) g^30 = 138 (mod 179) g^31 = 160 (mod 179) g^32 = 166 (mod 179) g^33 = 173 (mod 179) g^34 = 164 (mod 179) g^35 = 157 (mod 179) g^36 = 151 (mod 179) g^37 = 142 (mod 179) g^38 = 122 (mod 179) g^39 = 85 (mod 179) g^40 = 34 (mod 179) g^41 = 102 (mod 179) g^42 = 46 (mod 179) g^43 = 138 (mod 179) g^44 = 160 (mod 179) g^45 = 166 (mod 179) g^46 = 173 (mod 179) g^47 = 164 (mod 179) g^48 = 157 (mod 179) g^49 = 151 (mod 179) g^50 = 142 (mod 179) g^51 = 122 (mod 179) g^52 = 85 (mod 179) g^53 = 34 (mod 179) g^54 = 102 (mod 179) g^55 = 46 (mod 179) g^56 = 138 (mod 179) g^57 = 160 (mod 179) g^58 = 166 (mod 179) g^59 = 173 (mod 179) g^60 = 164 (mod 179) g^61 = 157 (mod 179) g^62 = 151 (mod 179) g^63 = 142 (mod 179) g^64 = 122 (mod 179) g^65 = 85 (mod 179) g^66 = 34 (mod 179) g^67 = 102 (mod 179) g^68 = 46 (mod 179) g^69 = 138 (mod 179) g^70 = 160 (mod 179) g^71 = 166 (mod 179) g^72 = 173 (mod 179) g^73 = 164 (mod 179) g^74 = 157 (mod 179) g^75 = 151 (mod 179) g^76 = 142 (mod 179) g^77 = 122 (mod 179) g^78 = 85 (mod 179) g^79 = 34 (mod 179) g^80 = 102 (mod 179) g^81 = 46 (mod 179) g^82 = 138 (mod 179) g^83 = 160 (mod 179) g^84 = 166 (mod 179) g^85 = 173 (mod 179) g^86 = 164 (mod 179) g^87 = 157 (mod 179) g^88 = 151 (mod 179) g^89 = 142 (mod 179) g^90 = 122 (mod 179) g^91 = 85 (mod 179) g^92 = 34 (mod 179) g^93 = 102 (mod 179) g^94 = 46 (mod 179) g^95 = 138 (mod 179) g^96 = 160 (mod 179) g^97 = 166 (mod 179) g^98 = 173 (mod 179) g^99 = 164 (mod 179) g^100 = 157 (mod 179) g^101 = 151 (mod 179) g^102 = 142 (mod 179) g^103 = 122 (mod 179) g^104 = 85 (mod 179) g^105 = 34 (mod 179) g^106 = 102 (mod 179) g^107 = 46 (mod 179) g^108 = 138 (mod 179) g^109 = 160 (mod 179) g^110 = 166 (mod 179) g^111 = 173 (mod 179) g^112 = 164 (mod 179) g^113 = 157 (mod 179) g^114 = 151 (mod 179) g^115 = 142 (mod 179) g^116 = 122 (mod 179) g^117 = 85 (mod 179) g^118 = 34 (mod 179) g^119 = 102 (mod 179) g^120 = 46 (mod 179) g^121 = 138 (mod 179) g^122 = 160 (mod 179) g^123 = 166 (mod 179) g^124 = 173 (mod 179) g^125 = 164 (mod 179) g^126 = 157 (mod 179) g^127 = 151 (mod 179) g^128 = 142 (mod 179) g^129 = 122 (mod 179) g^130 = 85 (mod 179) g^131 = 34 (mod 179) g^132 = 102 (mod 179) g^133 = 46 (mod 179) g^134 = 138 (mod 179) g^135 = 160 (mod 179) g^136 = 166 (mod 179) g^137 = 173 (mod 179) g^138 = 164 (mod 179) g^139 = 157 (mod 179) g^140 = 151 (mod 179) g^141 = 142 (mod 179) g^142 = 122 (mod 179) g^143 = 85 (mod 179) g^144 = 34 (mod 179) g^145 = 102 (mod 179) g^146 = 46 (mod 179) g^147 = 138 (mod 179) g^148 = 160 (mod 179) g^149 = 166 (mod 179) g^150 = 173 (mod 179) g^151 = 164 (mod 179) g^152 = 157 (mod 179) g^153 = 151 (mod 179) g^154 = 142 (mod 179) g^155 = 122 (mod 179) g^156 = 85 (mod 179) g^157 = 34 (mod 179) g^158 = 102 (mod 179) g^159 = 46 (mod 179) g^160 = 138 (mod 179) g^161 = 160 (mod 179) g^162 = 166 (mod 179) g^163 = 173 (mod 179) g^164 = 164 (mod 179) g^165 = 157 (mod 179) g^166 = 151 (mod 179) g^167 = 142 (mod 179) g^168 = 122 (mod 179) g^169 = 85 (mod 179) g^170 = 34 (mod 179) g^171 = 102 (mod 179) g^172 = 46 (mod 179) g^173 = 138 (mod 179) g^174 = 160 (mod 179) g^175 = 166 (mod 179) g^176 = 173 (mod 179) g^177 = 164 (mod 179) g^178 = 157 (mod 179) As we can see, all values from g^0 to g^(p-2) are distinct modulo p = 179. Therefore, g = 3 is a generator for p = 179.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值