// 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, l, 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;
}
Ideone.com - XTivZx - Online C++ Compiler & Debugging Tool
Computer Methods in Science Course
Subscribe to:
Post Comments (Atom)
NaCl.xyz Generator with Interactive 3D Visualization
NaCl.xyz Generator with Interactive 3D Visualization NaCl.xyz Generator with Interactive 3D Visualization ...
-
In mathematics, Pascal's triangle is a triangular array of the binomial coefficients Coasters (Set of 4) $13.91 #MOVING #EYE #ILLUSION #...
-
Cognitive Science Hexagon - научные направления, которые способствовали зарождению когнитивной наукиActive T-Shirt $25.00 Baseball ¾ Sleeve T-Shirt $25.20 Classic T-Shirt $19.90 Graphic T-Shirt $28.22 Lightweight Hoodie $34.85 Lightweight S...
-
Get my art printed on awesome products. Support me at Redbubble Unit #circle #angles. #Trigonometry, #Math Formulas, Geometry Formu...
ReplyDeleteWest Bengal Board of Secondary Education (WBBSE) Government Agency 1st, 2nd, third, 4th, 5th Class Final Exam Conducted will Start from Month of Jun (Expected) 2021,SCERT West Bengal 1st Class e-Books WB 1st, 2d, third, 4th, 5th Class Practical Exam 2021 can be Start from Month of March or May 2021 (Expected), Students 10thmodelpaper.In Provide West Bengal 1st, 2d, third, 4th, fifth Class Study Material Bengali, English, Medium Pdf Format
Maharashtra State Board Of Secondary And Higher Secondary Education will release Maharashtra 10th Model Paper 2022 in pdf format. Students can access Question Papers for a variety of courses via the internet, including Math, Science, and English. Maharashtra 10th Model Paper 2022 They can verify the marking scheme and examination pattern of the Maharashtra SSC Exam in the sample paper. Students can learn about the types of questions asked in the test by looking at previous Maharashtra SSC Board Question Papers Pdf. To learn more, read the article below.
ReplyDelete