Number Systems Part 3: Figurate Numbers & Famous Sequences

Author: Pawan Pandey | Date: November 19, 2024 | Read Time: 16 min

Introduction: Where Geometry Meets Arithmetic

Figurate numbers bridge the visual and numerical worlds, representing quantities that can be arranged into regular geometric shapes. From the triangular numbers that intrigued ancient Greek mathematicians to the Fibonacci sequence found throughout nature, these number patterns reveal deep connections between mathematics, nature, and computation. In this article, we explore how these elegant sequences power modern algorithms and inspire AI architecture design.

What You'll Discover

  • Triangular numbers and their connection to summation formulas
  • Square and cube numbers in geometry and computing
  • Fibonacci sequence: nature's algorithm and its AI applications
  • Factorials: permutations, combinations, and complexity analysis
  • Pentagonal and hexagonal numbers in advanced mathematics
  • How these sequences optimize algorithms and neural architectures

1. Triangular Numbers: The Sum of Natural Numbers

Visual Understanding

Definition: Numbers that can be arranged in an equilateral triangle.

Formula: T_n = n(n+1)/2 = 1 + 2 + 3 + ... + n

Sequence: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55...

Visual Representation:

T₁ = 1    T₂ = 3    T₃ = 6    T₄ = 10
   •         •         •          •
            • •       • •        • •
                     • • •      • • •
                               • • • •

Each row has one more dot than the previous!

Faulhaber's Formula and Gauss's Trick

The Famous Gauss Story (Age 10):
Teacher asked: "Sum 1 + 2 + 3 + ... + 100"

Gauss's insight:
  1 +   2 +   3 + ... +  98 +  99 + 100
100 +  99 +  98 + ... +   3 +   2 +   1
─────────────────────────────────────────
101 + 101 + 101 + ... + 101 + 101 + 101

100 pairs, each summing to 101
Sum = (100 × 101) / 2 = 5,050

General Formula:
T_n = n(n+1)/2

Properties and Patterns

Amazing Properties:

1. Sum of two consecutive triangulars = square number
   T₃ + T₄ = 6 + 10 = 16 = 4²
   T_n + T_(n+1) = (n+1)²

2. Every integer is sum of at most 3 triangular numbers

3. Test for triangular: n is triangular if 8n+1 is perfect square
   T₁₀ = 55 → 8(55)+1 = 441 = 21² ✓

4. Alternating sum of cubes equals triangular number squared

Applications in Algorithms and AI

  • Complexity Analysis: Nested loops O(n²) operations = T_n comparisons
  • Handshake Problem: n people shaking hands = T_(n-1) handshakes
  • Graph Theory: Complete graph K_n has T_(n-1) edges
  • Matrix Operations: Upper/lower triangular matrices
  • Neural Networks: Connection counts in fully connected layers

2. Square Numbers: Perfect Squares

Visual and Mathematical Understanding

Definition: Numbers that can be arranged in a square array.

Formula: S_n = n² = n × n

Sequence: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100...

Visual Representation:

S₁ = 1²   S₂ = 2²   S₃ = 3²   S₄ = 4²
   •       • •       • • •     • • • •
           • •       • • •     • • • •
                     • • •     • • • •
                               • • • •

Odd Number Pattern:
1² = 1 = 1
2² = 4 = 1 + 3
3² = 9 = 1 + 3 + 5
4² = 16 = 1 + 3 + 5 + 7

n² = sum of first n odd numbers!

Properties and Patterns

Square Number Properties:

1. Difference between consecutive squares:
   (n+1)² - n² = 2n + 1 (always odd!)

2. Sum of squares formula:
   1² + 2² + 3² + ... + n² = n(n+1)(2n+1)/6

3. Pythagorean triples (a² + b² = c²):
   3² + 4² = 5² → 9 + 16 = 25 ✓
   5² + 12² = 13² → 25 + 144 = 169 ✓

4. Last digit pattern: 0,1,4,9,6,5 only
   Never ends in 2, 3, 7, or 8!

Applications in Computing and ML

  • Image Processing: Square pixel grids (256×256, 512×512)
  • Convolution: Square kernels (3×3, 5×5, 7×7)
  • Loss Functions: Mean Squared Error (MSE)
  • Distance Metrics: Euclidean distance uses squared differences
  • Variance: σ² measures squared deviations

3. Cube Numbers: Three-Dimensional Power

Definition and Properties

Definition: Numbers obtained when a number is multiplied by itself three times.

Formula: C_n = n³ = n × n × n

Sequence: 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000...

Cube Number Properties:

1. Sum of cubes formula:
   1³ + 2³ + 3³ + ... + n³ = [n(n+1)/2]² = (T_n)²
   Sum of cubes = Square of triangular number!

2. Ramanujan's taxicab numbers:
   1729 = 1³ + 12³ = 9³ + 10³
   (Smallest sum of two cubes in two ways)

3. Fermat's Last Theorem (for n=3):
   No positive integers a, b, c satisfy a³ + b³ = c³

Applications in 3D and Deep Learning

  • 3D Convolutions: Video processing, medical imaging
  • Voxel Grids: 3D object representation
  • Cubic Complexity: O(n³) algorithms (matrix multiplication)
  • Volume Calculations: 3D bounding boxes
  • Tensor Operations: 3D tensors in neural networks

4. Fibonacci Sequence: Nature's Algorithm

The Most Famous Sequence

Definition: Each term is the sum of the two preceding terms.

Recurrence: F(n) = F(n-1) + F(n-2), with F(0)=0, F(1)=1

Sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...

Understanding Fibonacci:

F(0) = 0
F(1) = 1
F(2) = F(1) + F(0) = 1 + 0 = 1
F(3) = F(2) + F(1) = 1 + 1 = 2
F(4) = F(3) + F(2) = 2 + 1 = 3
F(5) = F(4) + F(3) = 3 + 2 = 5
F(6) = F(5) + F(4) = 5 + 3 = 8

Binet's Formula (Closed Form)

Binet's Formula (Direct calculation):

F(n) = (φⁿ - ψⁿ) / √5

Where:
φ = (1 + √5) / 2 ≈ 1.618... (Golden Ratio)
ψ = (1 - √5) / 2 ≈ -0.618...

As n increases, ψⁿ → 0, so:
F(n) ≈ φⁿ / √5 (for large n)

Golden Ratio Connection

The Golden Ratio (φ):

Ratio of consecutive Fibonacci numbers approaches φ:

F(2)/F(1) = 1/1 = 1.000
F(5)/F(4) = 5/3 = 1.667
F(10)/F(9) = 55/34 = 1.618
...
lim(n→∞) F(n+1)/F(n) = φ = 1.618033988...

Golden Ratio Properties:
φ = (1 + √5) / 2
φ² = φ + 1
1/φ = φ - 1

Fibonacci in Nature

  • Flower Petals: Lilies (3), Buttercups (5), Delphiniums (8)
  • Pinecones: Spirals appear in Fibonacci numbers (8, 13, 21)
  • Sunflower Seeds: 34 spirals one way, 55 the other
  • Tree Branching: Branch patterns follow Fibonacci growth
  • Shell Spirals: Nautilus shells approximate golden spiral
  • Human Body: Finger bones ratio ≈ golden ratio

Fibonacci in Algorithms and AI

  • Fibonacci Search: Search algorithm O(log n) complexity
  • Dynamic Programming: Classic example for memoization
  • Fibonacci Heap: Efficient priority queue data structure
  • Network Architecture: Fibonacci-inspired layer sizing
  • Optimization: Golden section search for minimization
  • Genetic Algorithms: Fibonacci-based selection strategies

5. Factorial Numbers: Permutations and Complexity

Definition and Growth

Definition: Product of all positive integers from 1 to n.

Notation: n! = n × (n-1) × (n-2) × ... × 2 × 1

Special Case: 0! = 1 (by definition)

Sequence: 1, 1, 2, 6, 24, 120, 720, 5040, 40320...

Understanding Factorials:

0! = 1
1! = 1
2! = 2 × 1 = 2
3! = 3 × 2 × 1 = 6
4! = 4 × 3 × 2 × 1 = 24
5! = 5 × 4 × 3 × 2 × 1 = 120
10! = 3,628,800

Growth Rate:
10! = 3.6 million
20! = 2.4 × 10¹⁸
50! = 3.0 × 10⁶⁴
100! = 9.3 × 10¹⁵⁷

Factorials grow FASTER than exponential!

Applications: Permutations and Combinations

Permutations (Order Matters):
P(n, r) = n! / (n-r)!

Example: Arrange 3 books from 5
P(5, 3) = 5! / 2! = 60

Combinations (Order Doesn't Matter):
C(n, r) = n! / (r! × (n-r)!)

Example: Choose 3 books from 5
C(5, 3) = 5! / (3! × 2!) = 10

Real-World Examples:
• Password: 10-digit PIN = 10! possibilities
• Lottery: Choose 6 from 49 = C(49,6) = 13,983,816
• Seating: 5 people = 5! = 120 arrangements

Factorials in Computer Science

  • Algorithm Complexity: O(n!) worst case (brute force)
  • Traveling Salesman: n! possible routes to check
  • Graph Isomorphism: n! vertex mappings to test
  • Backtracking: Permutation generation algorithms
  • Neural Architecture Search: Exponential search spaces

6. Pentagonal and Hexagonal Numbers

Pentagonal Numbers

Definition: Numbers representing nested pentagons.

Formula: P_n = n(3n-1)/2

Sequence: 1, 5, 12, 22, 35, 51, 70, 92, 117, 145...

Examples:
P₁ = 1(3×1-1)/2 = 1
P₂ = 2(3×2-1)/2 = 5
P₃ = 3(3×3-1)/2 = 12
P₄ = 4(3×4-1)/2 = 22

Hexagonal Numbers

Definition: Numbers representing nested hexagons.

Formula: H_n = n(2n-1)

Sequence: 1, 6, 15, 28, 45, 66, 91, 120, 153, 190...

Examples:
H₁ = 1(2×1-1) = 1
H₂ = 2(2×2-1) = 6
H₃ = 3(2×3-1) = 15
H₄ = 4(2×4-1) = 28

Relationship to Triangular:
Every hexagonal number is also triangular!
H_n = T_(2n-1)

Figurate Number Relationships

  • Every hexagonal number is triangular
  • Sum of consecutive triangular = square
  • Pentagonal numbers appear in partition theory
  • All relate through polynomial formulas

Summary: Pattern Recognition in Sequences

Sequence Formula First 10 Terms Growth Rate
Sequence Triangular Formula n(n+1)/2 First 10 Terms 1,3,6,10,15... Growth Rate O(n²)
Sequence Square Formula First 10 Terms 1,4,9,16,25... Growth Rate O(n²)
Sequence Cube Formula First 10 Terms 1,8,27,64,125... Growth Rate O(n³)
Sequence Fibonacci Formula F(n-1)+F(n-2) First 10 Terms 1,1,2,3,5,8... Growth Rate O(φⁿ) exponential
Sequence Factorial Formula n! First 10 Terms 1,1,2,6,24,120... Growth Rate O(n!) super-exp
Sequence Pentagonal Formula n(3n-1)/2 First 10 Terms 1,5,12,22,35... Growth Rate O(n²)
SequenceHexagonal Formula n(2n-1) First 10 Terms 1,6,15,28,45... Growth Rate O(n²)

Conclusion

Figurate numbers and famous sequences represent more than mathematical curiosities—they embody fundamental patterns that appear throughout nature, computing, and artificial intelligence. From the Fibonacci sequence optimizing neural architectures to factorial growth defining algorithmic complexity, these patterns provide both inspiration and practical tools for modern algorithm design.

Key Insights

  • Triangular numbers model nested loop complexity and graph connections
  • Square numbers are fundamental to loss functions and distance metrics
  • Fibonacci sequence inspires efficient architectures and search algorithms
  • Factorial growth defines the worst-case complexity ceiling
  • Golden ratio provides optimal search and aesthetic proportions
  • Figurate numbers connect geometry with arithmetic elegantly

Nature's Mathematics: The ubiquity of these sequences in nature—from flower petals to galaxy spirals—suggests that evolution itself has "discovered" these mathematical patterns as optimal solutions to biological problems. AI researchers increasingly look to these natural patterns for inspiration in designing efficient and effective algorithms.

Continue Exploring

Complete your journey through number systems:

  • Complete Guide: Comprehensive overview
  • Part 1: Basic Number Sets (Natural to Complex)
  • Part 2: Special Numbers & Classifications