21 lines
576 B
C++
21 lines
576 B
C++
|
|
#include <bits/stdc++.h>
|
|||
|
|
using namespace std;
|
|||
|
|
int main() {
|
|||
|
|
// 讨论F(i)与f(i)的所有因子之间的关联关系
|
|||
|
|
int n = 100;
|
|||
|
|
for (int i = 1; i <= n; i++) {
|
|||
|
|
printf("F(%d)=", i);
|
|||
|
|
bool f = 1;
|
|||
|
|
for (int j = 1; j <= n; j++) {
|
|||
|
|
if (i % j == 0) { // 如果j是i的因子的话,输出f(j)
|
|||
|
|
if (f) {
|
|||
|
|
printf("f(%d)", j);
|
|||
|
|
f = 0;
|
|||
|
|
} else
|
|||
|
|
printf("+f(%d)", j);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
printf("\n");
|
|||
|
|
}
|
|||
|
|
return 0;
|
|||
|
|
}
|