For any given natural number N, the irreducible true fraction of the denominator less than or equal to n is arranged in ascending order, and the first score is preceded by 0/1, followed by the last score plus 1/1, which is known as the N-level sequence of mines, denoted by FN. such as F5:0/1,1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5,1/1. The number of elements is 11.
Now give n lets you ask for the permutation and number of elements in the N-level sequence of lightning.
1#include <stdio.h>2#include <stdlib.h>3 intn,s;4 voidPreintAintBintCintD) {//using binary method to output the sequence of thunder5 if(b+d>n)return ;6Pre (a,b,a+c,b+d);7printf"%d/%d,", a+c,b+d);8Pre (a+c,b+d,c,d);9 }Ten intEular (intN) {//using Euler function to find the number of N-Reciprocity One Doublesum=N; A inti; - for(i=2; i<=n;i++){ - if(n%i==0){ theSum*= (1-1.0/i); - while(n%i==0){ -n=n/i; - } + } - } + return(int) sum; A } at intSUM (intN//Euler function Summation - { - intj,sum=0; - for(j=2; j<=n;j++) -sum+=Eular (j); - returnsum; in } - to intMain () + { -scanf"%d",&n); theprintf"0/1,"); *Pre0,1,1,1); $printf"1/1\n");Panax Notoginsengs=SUM (n); -printf"%d", s+2); the + return 0; A}
"C-Language Program" Valeo series