记 f(x)f(x) 表示整数 xx 的位数,你看看每一个 f(i×(i−1)),语文不太好,看看代码,有一个很微妙但是我说不出来的规律。
#include<bits/stdc++.h>
#define int __int128
using namespace std;
int f(int x){
int ans = 0;
while(x)
ans++, x /= 10;
return ans;
}
signed main(){
signed cnt = 1;
for(int i = 3; i <= 10000000; i++){
if(f(i*(i-1)) != f((i-1)*(i-2)))
cout << cnt << endl,
cnt = 1;
else cnt ++;
}
return 0;
}
// 运行结果
2
7
22
68
216
684
2162
6838
21623
68377
216228
683772
2162278