Magical numbers 7 and 2 with Python

(7 minutes read)

**** thats my first try for a Medium story****

7 days a week,

7 dwarfs in Snowwhite

7 deadly sins

7 colors of a rainbow

7 fingers in my hand

7 ISO protocol levels

007 James Bond

7 Plus or Minus Two, by the cognitive psychologist George A. Miller

I traveled the world and the 7 seas, by Eurythmics

7, the seven-continent model usually taught in China.

7, Seven Samurai, fim by Akira Kurosawa, 1954

What else ?

Seven is more complex and more magical than you believe, so is 2.

The magical 7 circuitries.

Let’s have a look to this red countdown circuit (7,6,5,4,3,2,1,7or zero).

Look at it during a long time, following the arrows ; now, are you zenfull, relax, stressless ?

Did’t you notice some strange symetry ?

7 6 5 4 .. 3 2 1 zero

……4+ 3 = 7

…..5+ ….2 = 7

…6+ ………1 = 7

7+ ………… = 7

Now, let me swap these labels in my little triangle.

4 swaps with 3,

5 swaps with 2,

6 swaps with 1,

7 swaps with 3zero.

Let’s paint the countdown circuit (zero,6,5,4,3,2,1,zero) with a green pencil. O miracle, the circuit is exactly the same, except an inverted orientation.

Thank you for your attention (Clapping shows your admiration for the magic trick, hmm).

Not clapping shows that you are aware of some properties of permtations in graph theory.

Opening the complex unit circle.

Here is a seventh degree equation :

z power 7 = 1, inside the field on complex numbers.

Ttey are seven solutions, let they be

r0, r1, r2, r3, r4, r5and r6.

Some people used to draw them on the unit trigonometric circle.

(source: en.wikipedia, complex number)

This image shows a visualisation of the square to sixth roots of a complex number z, in polar form reiφ where φ = arg z and r = |z | — if z is real, φ = 0 or π with Euler’s formula.

My image is simpler beacause Z=1, so the visualisation of the seven of the 7 roots is the following :

Opening the Python box.

It’s time to illustrate some circle properties with a little help from Python langage.

A) please add r1, r2and r4. You obtain p124, red-colored, I draw this addition with the parallelogram rule, firstly p12 with the green #, secondly p124 with the blue #.

Then, you can verify at home on your kitchen table,

the length of segment Op124 is square root of 2, who should have guessed ?

And p124 is projected on the x-axis in the middle of OM, who should ask for more ?

The python programm

import math

alpha_rad = math.pi*2/7

print(“alpha_rad==” , alpha_rad)

# hello Code Like a Girl ! #

r0 = complex(1)

r1 =complex(math.cos( 1*alpha_rad ),math.sin( 1*alpha_rad ))

r2 =complex(math.cos( 2*alpha_rad ),math.sin( 2*alpha_rad ))

r3 =complex(math.cos( 3*alpha_rad ),math.sin( 3*alpha_rad ))

r4 =complex(math.cos( 4*alpha_rad ),math.sin( 4*alpha_rad ))

r5 =complex(math.cos( 5*alpha_rad ),math.sin( 5*alpha_rad ))

r6 =complex(math.cos( 6*alpha_rad ),math.sin( 6*alpha_rad ))

print(“r0 r1 r2 r3 r4 r5 r6==” , r0,r1,r2,r3,r4,r5,r6)

p12 = r1+r2

p124 = p12+r4

print(“ p12,p124==” , p12,p124 )

x= p124.real

y= p124.imag

print(“x y==” ,x,y )

print(“ math.sqrt(7)/2==” , math.sqrt(7)/2 )

and the result is >>>

alpha_rad== 0.8975979010256552

r0 r1 r2 r3 r4 r5 r6== (1+0j) (0.6234898018587336+0.7818314824680298j) (-0.22252093395631434+0.9749279121818236j) (-0.900968867902419+0.43388373911755823j) (-0.9009688679024191–0.433883739117558j) (-0.2225209339563146–0.9749279121818236j) (0.6234898018587334–0.7818314824680299j)

p12,p124== (0.40096886790241926+1.7567593946498534j) (-0.4999999999999999+1.3228756555322954j)

x y== -0.4999999999999999 1.3228756555322954

math.sqrt(7)/2== 1.3228756555322954

B) do you see the axis of symetry in half-plotted line ?

This line is also the conjugacy axis of two complex numbers.

So r6 is the conjugate of r1,

r5 is the conjugate of r2,

r3 is the conjugate of r4,

p653 is the conjugate of p124.

If you multiply p124 and p653 you obtain x²+y², that’s a well-known formula oof conjugate complex numbers.

Let’s look with athis little python programm :

p65 = r6+r5

p653 = p65+r3

print(“ p65,p653==” , p65,p653 )

result_multiply = p124*p653

print(“ result_multiply==” , result_multiply )

and the result is >>>

p65,p653== (0.4009688679024188–1.7567593946498534j) (-0.5000000000000002–1.3228756555322951j)

result_multiply== (1.9999999999999998–5.551115123125783e-16j)

C) so, w have got two results :

with Pythagore theorem of O-m-p124 triangle

sqrt(2)² = ( 1/2 )²+( sqrt(7)/2)²

that is a pretty magic relationship between 7 and 2.

( r1 + r2 + r4 )*( r6 + r5 + r3 ) = 2

you can notice that 1–2–4 are the labels at the base of the first red circuit and 6–5–3 those of the green circuit, hence I chose ( r1 + r2 + r4 ) and ( r6 + r5 + r3 ).

Opening several substraction tables.

What is the next question ?

Why are 1–2–4 the labels at the base of the red circuit, and not 1–2–3 ?

the answer is not that simple.

Now let 0 1 2 3 4 5 6 be the integer numbers modulo 7 where zero=7.

The full substraction table is

now that substraction subtable

the blue cells contain only 0 1 2 5 6, but 4 and 3 are missing.

Another substraction subtable

nobody is missing in blue cells, but that table is 4x4 sized, it’s heavy.

Endly this smart substraction subtable

smart because 0 1 2 3 4 5 6 all occur in the blue cells and its size is 3x3.

We call it a minimal substraction subtable.

That’s the reason why I chose 1–2–4 for labelling the base of the red circuit.

You easily can verify that (6,5,3)x(6,5,3) is a suitable minimal substraction subtable too.

What a strange relationship between 7 and 2 !

Abstract before a further story.

We got tree magical numbers : 7, 3, 1, with four equations :


sqrt(3–1)² = ( 1/2 )²+( sqrt(7)/2 )²

( r1 + r2 + r4 )*( r6 + r5 + r3 ) = 3–1

(3–1)**0 + (3–1)**1 + (3–1)**2 =7

I call (7, 3, 1) a magical triptych.

And what about the ( 3, 2 , 1 ) triptych ? Come on to the magical mystery tour.

(dedicated to Pythagore, Euler, Fano, Beattles, Claude Berge)

Like what you read? Give Bailly a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.