| 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
Monday 16 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 (Master’s Thesis, MIT, 1937)
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-1852, English mathematician and first programmer using punched card
Diagram of Bernoulli numbers (1843): first published computer algorithm. Planned for the Babbage’ analytical machine.

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
Chained adders to sum bit per bit



Inspiration: Ben Eater: Making logic gates from transistors



Exclusive OR: 1 only if one input is 1
1 only if both inputs are 1
Source: Real Engineering channel: Transistors - The invention that Changed The World

2 XOR + 2 AND + 1 OR gate

4 bits full adder. First is half-adder.

AND gate on the left, OR gate on the right
Source: Ben Eater: Making logic gates from transistors
How computer went faster and smaller. But designed for phone comp

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!
Department 1127 Bell Labs: UNIX (Dec 1969)

Dennis Ritchie and Ken Thompson
Created the C language, modern file architecture, pipes, shells, everything a process etc. Files contains uninterpreted bytes. Any device can then be part of the file system. Abstraction that can connect any new devices.
Legacy of UNIX is everywhere:
[1] "2026-04-21"
[1] 20564
[1] "1970-01-01"
Source: Nokia bell labs. Brian Kernighan UNIX history and a memoir.
1974 a copy of AT&T Research Unix launched the University of California, Berkeley.
Will become the Berkeley Software Distribution (BSD), then FreeBSD, MacOS etc.
Source: By Eraserhead1, Infinity0, Sav_vas - Own work using: Levenez Unix History Diagram, Information on the history of IBM’s AIX on ibm.com, CC BY-SA 3.0 Wikipedia
Linus Torvalds
Who wanted to understand things.

At 22, he open-sourced his own OS

All android phones, all world servers, cars etc.
Source: Linus Torvalds, “Just For Fun” autobiography with David Diamond



wordcloud from : wikimedia
printSystem.out.print();printf();section .data
msg db "Hello from BASV!", 10 ; 10 is newline
len equ $ - msg
section .text
global _start
_start:
mov rax, 1 ; syscall: sys_write
mov rdi, 1 ; file descriptor: stdout
mov rsi, msg ; pointer to string
mov rdx, len ; length of string
syscall
mov rax, 60 ; syscall: sys_exit
xor rdi, rdi ; exit code 0
syscallnasm -f elf32 hello.asm -o hello.o
ld -m elf_i386 hello.o -o hello
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 and my own breadboard adders


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!
