51nod 1136 尤拉函式

2021-07-22 09:50:23 字數 557 閱讀 5452

對正整數n,尤拉函式是少於或等於n的數中與n互質的數的數目。此函式以其首名研究者尤拉命名,它又稱為euler's totient function、φ函式、尤拉商數等。例如:φ(8) = 4(phi(8) = 4),因為1,3,5,7均和8互質。

input

輸入乙個數n。(2 <= n <= 10^9)
output

輸出phi(n)。
input示例

8
output示例

4

寫尤拉函式的函式,**如下:

#include#include#include#includeusing namespace std;

#define n 10010

char a[n];

int b[30];

int main()

sort(b,b+26);

long long int sum=0;

int k=26;

//for(i=0;i<26;i++) cout<=0;i--)

cout<

51nod1136 尤拉函式

對正整數n,尤拉函式是少於或等於n的數中與n互質的數的數目。此函式以其首名研究者尤拉命名,它又稱為euler s totient function 函式 尤拉商數等。例如 8 4 phi 8 4 因為1,3,5,7均和8互質。input 輸入乙個數n。2 n 10 9 output 輸出phi n ...

51nod 1136 尤拉函式

1136 尤拉函式 基準時間限制 1 秒 空間限制 131072 kb 分值 0 難度 基礎題 收藏 取消關注 對正整數n,尤拉函式是少於或等於n的數中與n互質的數的數目。此函式以其首名研究者尤拉命名,它又稱為euler s totient function 函式 尤拉商數等。例如 8 4 phi ...

51nod 1136 尤拉函式

1136 尤拉函式 基準時間限制 1 秒 空間限制 131072 kb 分值 0 難度 基礎題 對正整數n,尤拉函式是少於或等於n的數中與n互質的數的數目。此函式以其首名研究者尤拉命名,它又稱為euler s totient function 函式 尤拉商數等。例如 8 4 phi 8 4 因為1,...