| Decimal | Binary |
|---|---|
| 0 | 0000000 |
| 1 | 0000001 |
| 2 | 0000010 |
| 3 | 0000011 |
| 4 | 0000100 |
| 5 | 0000101 |
| 6 | 0000110 |
| 7 | 0000111 |
| 8 | 0001000 |
| 9 | 0001001 |
| 10 | 0001010 |
| 11 | 0001011 |
| 12 | 0001100 |
| 13 | 0001101 |
| 14 | 0001110 |
| 15 | 0001111 |
| 107 | 1101011 |
and computers
University of Luxembourg
Saturday, the 14th of March, 2026
You will learn to:

for/if)

OS: / /
OS: /
Many machine OS: : PlayStation, smartTV, routeurs, servers
GB = 8 Gb
Picture: Andrey Matveev, Unsplash

Photo by Benjamin Lehman, Unsplash
| Decimal | Binary |
|---|---|
| 0 | 0000000 |
| 1 | 0000001 |
| 2 | 0000010 |
| 3 | 0000011 |
| 4 | 0000100 |
| 5 | 0000101 |
| 6 | 0000110 |
| 7 | 0000111 |
| 8 | 0001000 |
| 9 | 0001001 |
| 10 | 0001010 |
| 11 | 0001011 |
| 12 | 0001100 |
| 13 | 0001101 |
| 14 | 0001110 |
| 15 | 0001111 |
| 107 | 1101011 |

…a circuit would automatically add two numbers using only relays and switches; for convenience using base 2. In fact any operation that can completely described in a finite number of steps using the words if, or, and etc. can be done automatically with relays. — Claude Shannon
Keep track / help for calculus (little stone in Latin)
Not necessarily decimal system, bi-quinary, 5-digit base-20 system etc.


Source: Wikipedia
Blaise Pascal in 1642-1645 conceived the Pascaline: direct additions / subtractions


Source: Wikipedia and Musée des Arts et Métiers, Paris.
Analytical Engine using punched cards (1834-1871)

1815-1827, English mathematician and first programmer using punched card
Diagram of Bernoulli numbers (1712): first published computer algorithm

Source: Wikipedia
Shannon formalism enabled quantification, entropy (noise) using the bit (coined by John Tukey also at Bell Labs).
The Mathematical Theory of Information (1948) laid the fundation of most of the digital world we live in.
Claude Shannon with “Theseus” the mouse in its Maze (1950)
Phone relays, trial and error using 75 bits and memorization of the escape route.

Source: The Information by James Gleick
1: Shannon found the necessary statistics in tables constructed for use by code breakers. Source: The Information by James Gleick
Adding 5 (0101) and 6 (0110) = 1011
Exclusive OR: 1 only if one input is 1
1 only if both inputs are 1
Source: Real Engineering channel: Transistors - The invention that Cahnged The World
Adding 5 (0101) and 6 (0110) = 1011
One bit at a time
XOR gate (sum): 0011
AND gate (carry): 0100

Missing full circuit:

Source: Real Engineering channel: Transistors - The invention that Cahnged The World and Science Direct
AND gate on the left, OR gate on the right
Source: Ben Eater: Making logic gates from transistors
How computer went faster and smaller

Relay comes from the word fresh horse that replaced an exhausted one (for long distance telegraphy, A weakened current could still operate a relay enabling a new circuit powered by a new battery) […] had more potential than its inventors realized” (combined signal from different sources).
Source: Wikipedia. Relay origin from James Gleick - The Information
5,000 relays computing \(\sqrt2\), sound ON!
Source: Curious Marc: 1958 FACOM 128B Japanese Relay Computer, still working!

wordcloud from : wikimedia
printSystem.out.print();printf();The same code for printing a 3-word string
Errors detected during execution lead to crash like division by 0
Floating point exception 💣
Errors that are not detected, execution continues
An algorithm is a well-ordered collection of unambiguous and effectively computable operations that when executed produces a result and halts in a finite amount of time
— Schneider and Gersting 1995


Credit: Balaban et al. (2021) Ten simple rules for quick and dirty scientific programming. PLoS Comput Biol
iif i is equal to 2i.in
[1] "found 2 in i = 2"
And with vectorization! What are the results?
“It is merely an empty basket until you put something in it — Charles Babbage
my_age, class_size to store a numbermy_name to store letters (a “string”)add_footer, for a function (action)is_odd, for a function that detects odd numbers and return a logical (TRUE/FALSE)Recommended by Hadley Wickham in Style)
We assign the name y to the values 1, 2, 3.
concatenation function is c()


global string pool is actually used for performance 
Pointers are memory addresses
if, else
Variables
|
Logical tests
|
|||
|---|---|---|---|---|
| A | B | A AND B | A OR B | NOT A |
| False | False | False | False | True |
| False | True | False | True | True |
| True | False | False | True | False |
| True | True | True | True | False |
What will be the difference?
if, else if and else{ and }{, RStudio does it for youWe will see dplyr::case_when() for multiple if / else statements
seq_along() handles empty vector)
Using functional programming.
Rcpp@EmEmEff @quominus the slowness of for() loops is legendary: a mixture of history and fiction.
— Thomas Lumley (@tslumley) 12 June 2015

For the students interested (= not mandatory):
As introduction to functions we have an extra 45 minutes course with the Cubetto.

You learned to:
I think that the present century will see a great upsurge and development of the whole information business (collection, transmitting and perhaps more importantly the business of processing it — Claude Shannon
Acknowledgments 🙏 👏
licensed under the CC International License.

Thank you for your attention!
