# massa7ca/fast_factorial architecture

> Architecture diagram of the GitHub repository massa7ca/fast_factorial, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/massa7ca/fast_factorial
- Repository: https://github.com/massa7ca/fast_factorial

## Overview

This repository is a collection of standalone factorial and smallest-multiple programs, not a shared application. Each implementation generates values and multiplies them using GMP-backed big integers; some variants parallelize the multiplication. The README documents GMP and a factorial compile/run example, but no shared runtime or links between implementations are shown. All substantial source files are represented; the relationships below show only GMP usage visible in the excerpts, not a common pipeline.

Main entry points: [`factorial.cpp`](https://github.com/massa7ca/fast_factorial/blob/master/factorial.cpp) (Factorial C++), [`factorial_V2.cpp`](https://github.com/massa7ca/fast_factorial/blob/master/factorial_V2.cpp) (Factorial C++ V2), [`factorial_V3.cpp`](https://github.com/massa7ca/fast_factorial/blob/master/factorial_V3.cpp) (Factorial C++ V3), [`factorial_method_Tree.cpp`](https://github.com/massa7ca/fast_factorial/blob/master/factorial_method_Tree.cpp) (Factorial product tree)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_factorial["Factorial programs"]
  node_factorial_cpp["Factorial C++<br/>[factorial.cpp]"]
  node_factorial_v2["Factorial C++ V2<br/>[factorial_V2.cpp]"]
  node_factorial_v3["Factorial C++ V3<br/>[factorial_V3.cpp]"]
  node_factorial_py["Factorial Python<br/>[factorial.py]"]
  node_factorial_tree["Factorial product tree"]
end

subgraph group_lcm["Smallest-multiple programs"]
  node_lcm_cpp["Smallest multiple C++"]
  node_lcm_v2["Smallest multiple C++ V2"]
  node_lcm_v3["Smallest multiple C++ V3"]
  node_lcm_py["Smallest multiple Python"]
end

node_gmp["GMP big integers"]

node_factorial_cpp -->|"multiplies with"| node_gmp
node_factorial_v2 -->|"multiplies with"| node_gmp
node_factorial_v3 -->|"multiplies with"| node_gmp
node_factorial_tree -->|"multiplies with"| node_gmp
node_lcm_cpp -->|"multiplies with"| node_gmp
node_lcm_v2 -->|"multiplies with"| node_gmp
node_lcm_v3 -->|"multiplies with"| node_gmp
node_lcm_py -->|"uses mpz"| node_gmp

click node_factorial_cpp "https://github.com/massa7ca/fast_factorial/blob/master/factorial.cpp"
click node_factorial_v2 "https://github.com/massa7ca/fast_factorial/blob/master/factorial_V2.cpp"
click node_factorial_v3 "https://github.com/massa7ca/fast_factorial/blob/master/factorial_V3.cpp"
click node_factorial_py "https://github.com/massa7ca/fast_factorial/blob/master/factorial.py"
click node_factorial_tree "https://github.com/massa7ca/fast_factorial/blob/master/factorial_method_Tree.cpp"
click node_lcm_cpp "https://github.com/massa7ca/fast_factorial/blob/master/SmallestMultiple.cpp"
click node_lcm_v2 "https://github.com/massa7ca/fast_factorial/blob/master/SmallestMultiple_V2.cpp"
click node_lcm_v3 "https://github.com/massa7ca/fast_factorial/blob/master/SmallestMultiple_V3.cpp"
click node_lcm_py "https://github.com/massa7ca/fast_factorial/blob/master/SmallestMultiple.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_factorial_cpp,node_factorial_v2,node_factorial_v3,node_factorial_py,node_factorial_tree toneBlue
class node_lcm_cpp,node_lcm_v2,node_lcm_v3,node_lcm_py toneAmber
class node_gmp toneIndigo
```

## Components

### Factorial programs

- [Factorial C++](https://github.com/massa7ca/fast_factorial/blob/master/factorial.cpp): `factorial.cpp`
- [Factorial C++ V2](https://github.com/massa7ca/fast_factorial/blob/master/factorial_V2.cpp): `factorial_V2.cpp`
- [Factorial C++ V3](https://github.com/massa7ca/fast_factorial/blob/master/factorial_V3.cpp): `factorial_V3.cpp`
- [Factorial Python](https://github.com/massa7ca/fast_factorial/blob/master/factorial.py): `factorial.py`
- [Factorial product tree](https://github.com/massa7ca/fast_factorial/blob/master/factorial_method_Tree.cpp): `factorial_method_Tree.cpp`

### Smallest-multiple programs

- [Smallest multiple C++](https://github.com/massa7ca/fast_factorial/blob/master/SmallestMultiple.cpp): `SmallestMultiple.cpp`
- [Smallest multiple C++ V2](https://github.com/massa7ca/fast_factorial/blob/master/SmallestMultiple_V2.cpp): `SmallestMultiple_V2.cpp`
- [Smallest multiple C++ V3](https://github.com/massa7ca/fast_factorial/blob/master/SmallestMultiple_V3.cpp): `SmallestMultiple_V3.cpp`
- [Smallest multiple Python](https://github.com/massa7ca/fast_factorial/blob/master/SmallestMultiple.py): `SmallestMultiple.py`

### Other components

- **GMP big integers**

## Connections

- Factorial C++ → GMP big integers: multiplies with (evidence: `factorial.cpp`)
- Factorial C++ V2 → GMP big integers: multiplies with (evidence: `factorial_V2.cpp`)
- Factorial C++ V3 → GMP big integers: multiplies with (evidence: `factorial_V3.cpp`)
- Factorial product tree → GMP big integers: multiplies with (evidence: `factorial_method_Tree.cpp`)
- Smallest multiple C++ → GMP big integers: multiplies with (evidence: `SmallestMultiple.cpp`)
- Smallest multiple C++ V2 → GMP big integers: multiplies with (evidence: `SmallestMultiple_V2.cpp`)
- Smallest multiple C++ V3 → GMP big integers: multiplies with (evidence: `SmallestMultiple_V3.cpp`)
- Smallest multiple Python → GMP big integers: uses mpz (evidence: `SmallestMultiple.py`)
