FREE INTERACTIVE ONLINE COURSE

Python 3

FOR BEGINNERS


"The first Python course that simply amazed me. Very well explained and easy to understand." (Alexandru Cosmin)

"The best Python course in Romania." (Iulian Geană)


ALL REVIEWS
APPLICATIONS
MATHEMATICS
Numerical Harmonies
Home >>> Free Online Lessons, Python 3

"Interesting" Triangles

Let's start with the example below:

    12 = 1
   112 = 121
  1012 = 10201
 10012 = 1002001
100012 = 100020001
...
After:

    12 = 1
   112 = 121
  1112 = 12321
 11112 = 1234321
111112 = 123454321
...
Exercises. Create Python programs using the learned instructions to display others:

a) 92, 992, 9992, 99992, ...

b) 93, 993, 9993, 99993, ...

c)
1+2+3+...+10 = 55
1+2+3+...+100 = 5050
1+2+3+...+1000 = 500500
1+2+3+...+10000 = 50005000
1+2+3+...+100000 = 5000050000
...

d)
1*9+2=11
21*9+33=222
321*9+444=3333
4321*9+5555=44444
...

e)
9*9+7=88
98*9+6=888
987*9+5=8888
...
98765432*9+0=888888888
987654321*9-1=8888888888

f)
15873*1*7=111111
15873*2*7=222222
15873*3*7=333333
...
15873*9*7=999999
Editor - numerical_harmonies.py
       
Output in the console done

Prime Numbers

You know that a natural number is prime if it is greater than 1 and has only two divisors: 1 and itself.

Examples: 2, 3, 5, 7, 11, 13, 17, 19, 23, ...

Look at the examples below:

a) sums with prime numbers:

12 + 1 + 17 = 19 = 17 + 2
22 + 2 + 17 = 23 = 19 + 4
32 + 3 + 17 = 29 = 23 + 6
...
102 + 10 + 17 = 127 = 107 + 20


b) other prime numbers:

12 - 79 * 1 + 1601 = 1523
22 - 79 * 2 + 1601 = 1447
32 - 79 * 3 + 1601 = 1373
...
92 - 79 * 9 + 1601 = 971


Interesting are also the following prime numbers, which have their reversals also prime:

13 and 31
17 and 71
37 and 73
79 and 97
107 and 701
...

Exercise. Can you create a Python program to display all pairs of numbers with this property, from 2 to 10000?
Hint. If you have followed the lessons, it is not so difficult... for example, you can create a function to check if a number is prime.

365 ?

How beautifully it can be written as sums of squares:

365 = 132 + 142
365 = 102 + 112 + 122

Palindromes

Some words or numbers form a palindrome, that is, they read the same from left to right as from right to left.

Examples of words: "cojoc", "reper", "rotitor", or sentences: "ele fac cafele", "ene purta patru pene", etc. Do you know others?

Numbers are diverse, such as 1234321 or 75257.

How beautiful are, for example, the following two equalities:

14641 = 1212
69696 = 2642

So, there are palindromic numbers that when squared, still result in a palindrome!

Exercise. Create a Python program to find other numbers with the same property! Test with large numbers, use loops, then conditional statements, ...

Pythagorean Numbers

You have probably learned about Pythagoras' Theorem for a right triangle:



It is known from practice that Pythagorean numbers have some interesting properties:

a) one of the legs is a multiple of 3;
b) one of the legs is a multiple of 4;
c) one of the Pythagorean numbers is a multiple of 5.

Examples. The simplest is 32 + 42 = 52. Then, we have:

52 + 122 = 132
72 + 242 = 252
82 + 152 = 172
92 + 402 = 412
112 + 602 = 612
...

Exercise. Create a Python program to display all Pythagorean triplets up to 10000.

The Universe of Numbers

There are many special cases, and what has been presented is minimal. Mathematics is fascinating, and the abundance of harmonies is great...

a) using all ten digits exactly once, we can write:

5649 * 3 = 807 * 21
5481 * 3 = 609 * 27

b) using each of the nine significant digits, you can write:

146 * 29 = 73 * 58
293 * 14 = 586 * 7
18 * 297 = 5346
27 * 198 = 5346

Exercise. Look, the squares of the following numbers are made up of the ten digits, each used once:

320432 = 1026753849
322862 = 1042385796
331442 = 1098524736

Write a Python program to display them all!

Good luck!

Bibliography

Mathematics for Everyone, Prof. Armand Martinov, Expert Publishing House, 2015, ISBN: 978-973-618-413-0
 home   list  CONTENTS   perm_identity   arrow_upward