// i: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...
// s(i): 1, 3, 4, 7, 6, 12, 8, 15, 13, 18, ...
// s(i) = sigma(i), the sum of the divisors of i
// Develop a C++ program to output n first elements of the sequence 1, 3, 4, 7, 6, ...
#include <iostream>
using namespace std;
int i,j,k,m,n,s;
int main() {
cin >> n;
cout << "n=" <<n<<endl;
for(i=1;i<=n;i++) cout << i <<'\t';
cout << endl;
for(i=1;i<=n;i++)
{
s=0;
for(j=1;j<=i;j++)
{
k=i/j;
m=k*j;
if(i==m)s=s+j;
}
cout << s <<'\t';
}
return 0;
}
Ly8gICAgaTogIDEsICAyLCAgMywgIDQsICA1LCAgIDYsICA3LCAgIDgsICA5LCAgIDEwLCAgLi4uCi8vIHMoaSk6IDEsICAzLCAgNCwgIDcsICA2LCAxMiwgIDgsIDE1LCAxMywgIDE4LCAgLi4uCi8vIHMoaSkgPSBzaWdtYShpKSwgdGhlIHN1bSBvZiB0aGUgZGl2aXNvcnMgb2YgaQovLyBEZXZlbG9wIGEgQysrIHByb2dyYW0gdG8gb3V0cHV0IG4gZmlyc3QgZWxlbWVudHMgb2YgdGhlIHNlcXVlbmNlIDEsIDMsIDQsIDcsIDYsIC4uLgoKI2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgaSxqLGssbSxuLHM7CmludCBtYWluKCkgewpjaW4gPj4gbjsKY291dCA8PCAibj0iIDw8bjw8ZW5kbDsKZm9yKGk9MTtpPD1uO2krKykgY291dCA8PCBpIDw8J1x0JzsKY291dCA8PCBlbmRsOwpmb3IoaT0xO2k8PW47aSsrKQp7CgpzPTA7CmZvcihqPTE7ajw9aTtqKyspCnsKaz1pL2o7Cm09aypqOwppZihpPT1tKXM9cytqOwp9CmNvdXQgPDwgcyA8PCdcdCc7Cn0KCXJldHVybiAwOwp9