prime-number-theorem Updated 2025-07-16
Consider this is a study in failed computational number theory.
The approximation converges really slowly, and we can't easy go far enough to see that the ration converges to 1 with only awk and primes:Runs in 30 minutes tested on Ubuntu 22.10 and P51, producing:
sudo apt intsall bsdgames
cd prime-number-theorem
./main.py 100000000
. It is clear that the difference diverges, albeit very slowly.
. We just don't have enough points to clearly see that it is converging to 1.0, the convergence truly is very slow. The logarithm integral approximation is much much better, but we can't calculate it in awk, sadface.
But looking at: en.wikipedia.org/wiki/File:Prime_number_theorem_ratio_convergence.svg we see that it takes way longer to get closer to 1, even at it is still not super close. Inspecting the code there we see:so OK, it is not something doable on a personal computer just like that.
(* Supplement with larger known PrimePi values that are too large for \
Mathematica to compute *)
LargePiPrime = {{10^13, 346065536839}, {10^14, 3204941750802}, {10^15,
29844570422669}, {10^16, 279238341033925}, {10^17,
2623557157654233}, {10^18, 24739954287740860}, {10^19,
234057667276344607}, {10^20, 2220819602560918840}, {10^21,
21127269486018731928}, {10^22, 201467286689315906290}, {10^23,
1925320391606803968923}, {10^24, 18435599767349200867866}};
python/sphinx/virtual_method Updated 2025-07-16
python/typing_cheat/hello.py Updated 2025-07-16
The hello world!
qiskit/hello.py Updated 2025-07-16
Sample program output,
counts
are randomized each time.First we take the quantum state vector immediately after the input.We understand that the first element of
input:
state:
Statevector([1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
dims=(2, 2))
probs:
[1. 0. 0. 0.]
Statevector
is , and has probability of 1.0.Next we take the state after a Hadamard gate on the first qubit:We now understand that the second element of the
h:
state:
Statevector([0.70710678+0.j, 0.70710678+0.j, 0. +0.j,
0. +0.j],
dims=(2, 2))
probs:
[0.5 0.5 0. 0. ]
Statevector
is , and now we have a 50/50 propabability split for the first bit.Then we apply the CNOT gate:which leaves us with the final .
cx:
state:
Statevector([0.70710678+0.j, 0. +0.j, 0. +0.j,
0.70710678+0.j],
dims=(2, 2))
probs:
[0.5 0. 0. 0.5]
Then we print the circuit a bit:
qc without measure:
┌───┐
q_0: ┤ H ├──■──
└───┘┌─┴─┐
q_1: ─────┤ X ├
└───┘
c: 2/══════════
qc with measure:
┌───┐ ┌─┐
q_0: ┤ H ├──■──┤M├───
└───┘┌─┴─┐└╥┘┌─┐
q_1: ─────┤ X ├─╫─┤M├
└───┘ ║ └╥┘
c: 2/═══════════╩══╩═
0 1
qasm:
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0],q[1];
measure q[0] -> c[0];
measure q[1] -> c[1];
qiskit/qft.py Updated 2025-07-16
This is an example of the
qiskit.circuit.library.QFT
implementation of the Quantum Fourier transform function which is documented at: docs.quantum.ibm.com/api/qiskit/0.44/qiskit.circuit.library.QFTOutput:So this also serves as a more interesting example of quantum compilation, mapping the
init: [1, 0, 0, 0, 0, 0, 0, 0]
qc
┌──────────────────────────────┐┌──────┐
q_0: ┤0 ├┤0 ├
│ ││ │
q_1: ┤1 Initialize(1,0,0,0,0,0,0,0) ├┤1 QFT ├
│ ││ │
q_2: ┤2 ├┤2 ├
└──────────────────────────────┘└──────┘
transpiled qc
┌──────────────────────────────┐ ┌───┐
q_0: ┤0 ├────────────────────■────────■───────┤ H ├─X─
│ │ ┌───┐ │ │P(π/2) └───┘ │
q_1: ┤1 Initialize(1,0,0,0,0,0,0,0) ├──────■───────┤ H ├─┼────────■─────────────┼─
│ │┌───┐ │P(π/2) └───┘ │P(π/4) │
q_2: ┤2 ├┤ H ├─■─────────────■──────────────────────X─
└──────────────────────────────┘└───┘
Statevector([0.35355339+0.j, 0.35355339+0.j, 0.35355339+0.j,
0.35355339+0.j, 0.35355339+0.j, 0.35355339+0.j,
0.35355339+0.j, 0.35355339+0.j],
dims=(2, 2, 2))
init: [0.0, 0.35355339059327373, 0.5, 0.3535533905932738, 6.123233995736766e-17, -0.35355339059327373, -0.5, -0.35355339059327384]
Statevector([ 7.71600526e-17+5.22650714e-17j,
1.86749130e-16+7.07106781e-01j,
-6.10667421e-18+6.10667421e-18j,
1.13711443e-16-1.11022302e-16j,
2.16489014e-17-8.96726857e-18j,
-5.68557215e-17-1.11022302e-16j,
-6.10667421e-18-4.94044770e-17j,
-3.30200457e-16-7.07106781e-01j],
dims=(2, 2, 2))
QFT
gate to Qiskit Aer primitives.If we don't
transpile
in this example, then running blows up with:qiskit_aer.aererror.AerError: 'unknown instruction: QFT'
The second input is:and the output of that approximately:which can be defined simply as the normalized DFT of the input quantum state vector.
[0, 1j/sqrt(2), 0, 0, 0, 0, 0, 1j/sqrt(2)]
From this we see that the Quantum Fourier transform is equivalent to a direct discrete Fourier transform on the quantum state vector, related: physics.stackexchange.com/questions/110073/how-to-derive-quantum-fourier-transform-from-discrete-fourier-transform-dft
Film about artificial intelligence Updated 2025-07-16
And by artificial intelligence, read of course (non-human-identical) artificial general intelligence.
Today-2022, this is placed under the science fiction film category. But maybe this might change during Ciro Santilli's own lifetime?
The basic criteria of "is a film about artificial intelligence good or not" to Ciro Santilli is: does the AI inhabit humanoid, or fully human looking, bodies? Bodies is a bad sign due to:
- the best science fiction works deeply explore the consequences of one single technology: efficient humanoid bodies are a second technological breakthrough besides AI itself. The first AI will obviously be a supercomputer without a body
- it is hard to imagine that the AI wouldn't organize itself as one huge central computer and R&D/command center. Perhaps there will be need for a few separate ones to optimize usage of natural resources, and to have some redundance in case a nuke blows the region, but there would be very very few of the think tanks. But having big centers is fundamental, because you centralize all the flow of ideas and their combination leading to new better outcomes for the AI. The mobile robot actors controlled by this center, if any exist, would then be slaves with some degree of autonomy and infinitely less computational powerful than the think tank.
Finite field Updated 2025-07-16
A convenient notation for the elements of of prime order is to use integers, e.g. for we could write:which makes it clear what is the additive inverse of each element, although sometimes a notation starting from 0 is also used:
For non-prime order, we see that modular arithmetic does not work because the divisors have no inverse. E.g. at order 6, 2 and 3 have no inverse, e.g. for 2:we see that things wrap around perfecly, and 1 is never reached.
Finite fields made easy by Randell Heyman (2015)
Source. Good introduction with examples Finite general linear group Updated 2025-07-16
general linear group over a finite field of order . Remember that due to the classification of finite fields, there is one single field for each prime power .
Exactly as over the real numbers, you just put the finite field elements into a matrix, and then take the invertible ones.
Flash memory Updated 2025-07-16
The Engineering Puzzle of Storing Trillions of Bits in your Smartphone / SSD using Quantum Mechanics by Branch Education (2020)
Source. Nice animations show how quantum tunnelling is used to set bits in flash memory. Flux qubit Updated 2025-07-16
In Ciro's ASCII art circuit diagram notation, it is a loop with three Josephson junctions:
+----X-----+
| |
| |
| |
+--X----X--+
Superconducting Qubit by NTT SCL (2015)
Source. Offers an interesting interpretation of superposition in that type of device (TODO precise name, seems to be a flux qubit): current going clockwise or current going counter clockwise at the same time. youtu.be/xjlGL4Mvq7A?t=1348 clarifies that this is just one of the types of qubits, and that it was developed by Hans Mooij et. al., with a proposal in 1999 and experiments in 2000. The other type is dual to this one, and the superposition of the other type is between N and N + 1 copper pairs stored in a box.
Their circuit is a loop with three Josephson junctions, in Ciro's ASCII art circuit diagram notation:
+----X-----+
| |
| |
| |
+--X----X--+
When half the magnetic flux quantum is applied as microwaves, this produces the ground state:where and cancel each other out. And the first excited state is:Then he mentions that:
- to go from 0 to 1, they apply the difference in energy
- if the duration is reduced by half, it creates a superposition of .
Form of government Updated 2025-07-16
Rasselas Prince of Abyssinia CHAPTER VIII www.gutenberg.org/cache/epub/652/pg652-images.html:
Oppression is, in the Abyssinian dominions, neither frequent nor tolerated; but no form of government has been yet discovered by which cruelty can be wholly prevented. Subordination supposes power on one part and subjection on the other; and if power be in the hands of men it will sometimes be abused. The vigilance of the supreme magistrate may do much, but much will still remain undone. He can never know all the crimes that are committed, and can seldom punish all that he knows.
Fourier transform Updated 2025-07-16
Continuous version of the Fourier series.
Can be used to represent functions that are not periodic: math.stackexchange.com/questions/221137/what-is-the-difference-between-fourier-series-and-fourier-transformation while the Fourier series is only for periodic functions.
Therefore, the Fourier transform can be seen as a generalization of the Fourier series that can also decompose functions defined on the entire real line.
As a more concrete example, just like the Fourier series is how you solve the heat equation on a line segment with Dirichlet boundary conditions as shown at: Section "Solving partial differential equations with the Fourier series", the Fourier transform is what you need to solve the problem when the domain is the entire real line.
Four Treasures of the Study Updated 2025-07-16
Frederick Sanger Updated 2025-07-16
Ah, this seems like a nice dude.
The Eighth Day of Creation has two nice paragraphs about his work. He was shy and quiet, and didn't boast about his slow and steady progress, possibly because of this he only had a junior fellowship and at some point some people wanted to kick him out of the lab somewhere between 1948 - 1952, quoted at: sandwalk.blogspot.com/2013/11/fred-sanger-1918-2013.html
Business film Updated 2025-07-16
Ciro Santilli defines a "business film" as a film about business, enterprises or entrepreneurship. Political thrillers are closed related as well.
This is one of his favorite film genres!
Some lists:
- www.99signals.com/movies-entrepreneur-watch-inspiration Hit and miss.
- www.imdb.com/list/ls033563570/ Best Business Movies and Documentaries by scott_dowle
Booda Bike Updated 2025-07-16
BookofProofs Updated 2025-07-16
No open signup it seems. TODO CV of owner.
They are making a proof assistant to integrate into the website: github.com/bookofproofs/fpl/, reminds Ciro Santilli of website front-end for a mathematical formal proof system.
Boosted fission weapon Updated 2025-07-16
Born-Oppenheimer approximation Updated 2025-07-16
Bose-Einstein condensate Updated 2025-07-16
Inward Bound by Abraham Pais (1988) page 282 shows how this can be generalized from the Maxwell-Boltzmann distribution
Unlisted articles are being shown, click here to show only listed articles.