Skip to content
/ code Public

Coding exercises in multiple programming languages (Python, Mojo...)

Notifications You must be signed in to change notification settings

bumbii/code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding exercises in Python and Mojo

$1.\quad S(n) = 1 + 2 + 3 + ...+ n.$ Python Mojo


$2.\quad S(n) = 1^2 + 2^2 + 3^2 + ... + n^2$ Python Mojo


$3.\quad S(n) = 1 + \frac{1}{2} + \frac{1}{3} + ... + \frac{1}{n}$ Python Mojo


$4.\quad S(n) = 1 + \frac{1}{4} + ... + \frac{1}{2n}$


$5.\quad S(n) = 1 + \frac{1}{3} + \frac{1}{5} + ... + \frac{1}{2n + 1}$


$6.\quad S(n) = \frac{1}{1 * 2} + \frac{1}{2 * 3} + ... + \frac{1}{n * (n + 1)}$


$7.\quad S(n) = \frac{1}{2} + \frac{2}{3} + \frac{3}{4} +... + \frac{n}{n + 1}$


$8.\quad S(n) = \frac{1}{2} + \frac{3}{4} + \frac{5}{6} +... + \frac{2n + 1}{2n + 2}$


$9.\quad T(n) = 1 * 2 * 3 * ... * n$


$10.\quad T(x, n) = x^n$


$11.\quad S(n) = 1 + 1 * 2 + 1 * 2 * 3 + ... + 1 * 2 * 3 * ... * n$


$12.\quad S(n) = x + x^2 + x^3 + ... + x^n$


$13.\quad S(n) = x^2 + x^4 + ... + x^{2n}$


$14.\quad S(n) = x + x ^ 3 + x^5 + ... + x^{2n + 1}$


$15.\quad S(n) = 1 + \frac{1}{1 + 2} + \frac{1}{1 + 2 + 3} + ... + \frac{1}{1 + 2 + 3 + ... + n}$


$16.\quad S(n) = x + \frac{x^2}{1 + 2} + \frac{x^3}{1 + 2 + 3} + ... + \frac{x^n}{1 + 2 + 3 + ... + n}$


$17.\quad S(n) = x + \frac{x^2}{2!} + \frac{x^3}{3!} + ... + \frac{x^n}{n!}$


$18.\quad S(n) = 1 + \frac{x^2}{2!} + \frac{x^4}{4!} + ... + \frac{x^{2n}}{(2n)!}$


$19.\quad S(n) = 1 + x + \frac{x^3}{3!} + \frac{x^5}{5!} + ... + \frac{x^{2n + 1}}{(2n + 1)!}$


$20.\quad \text{List all divisors of a positive integer \textcolor{green}{N}.}$

$\text{Example 1: input: N = 6, output: 1, 2, 3, 6}$

$\text{Example 2: input: N = 10, output: 1, 2, 5, 10}$


$21. \text{Given a positive integer \textcolor{green}{N}. Find the sum of all divisors of \textcolor{green}{N}.}$

$\text{Example: input: N = 6, output: 12}$

$\text{Explain:}$

$\text{The divisors of 6 are: 1, 2, 3, 6}$

$sum = 1 + 2 + 3 + 6 = 12$

References

  1. Programming Exercises (Vietnamese: Bài tập kỹ thuật lập trình) - Author: Nguyễn Tấn Trần Minh Khang (My teacher at University (University of Sciences, HCM City))
  2. Python in highschool - Author: Arnaud Bodin
  3. How to write mathematical expressions on Github

About

Coding exercises in multiple programming languages (Python, Mojo...)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages