μˆ˜ν•™ μ•Œκ³ λ¦¬μ¦˜Beginner

μ—λΌν† μŠ€ν…Œλ„€μŠ€μ˜ 체

ν•©μ„±μˆ˜λ₯Ό 반볡적으둜 μ œκ±°ν•˜μ—¬ nκΉŒμ§€μ˜ λͺ¨λ“  μ†Œμˆ˜λ₯Ό μ°ΎμŠ΅λ‹ˆλ‹€. μ—λΌν† μŠ€ν…Œλ„€μŠ€ (기원전 276-194λ…„)의 이름을 λ”°μ„œ λͺ…λͺ…λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

#mathematical#prime-numbers#number-theory#ancient-algorithm

Complexity Analysis

Time (Average)

O(n log log n)

Expected case performance

Space

O(n)

Memory requirements

Time (Best)

O(n log log n)

Best case performance

Time (Worst)

O(n log log n)

Worst case performance

How it works

  • β€’ Find all prime numbers up to n
  • β€’ Iteratively mark composites
  • β€’ O(n log log n) time complexity
  • β€’ O(n) space complexity
  • β€’ Named after Eratosthenes of Cyrene (c. 276-194 BC)
Step: 1 / 0
500ms
SlowFast
Keyboard Shortcuts
Space Play/Pause← β†’ StepR Reset1-4 Speed

Real-time Statistics

Algorithm Performance Metrics

Progress0%
Comparisons
0
Swaps
0
Array Accesses
0
Steps
1/ 0

Algorithm Visualization

Step 1 of 0

Initialize array to begin

Default
Comparing
Swapped
Sorted

Code Execution

Currently executing
Previously executed

Implementation

Sieve of Eratosthenes - Algorithm Vision