Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

It fits because the compact version is not a conventional, readable CPU emulator: it compresses a gate-level simulation of the Intel 4004 and the supporting chips into a tightly packed C program. That simulated hardware runs the original Busicom 141-PF calculator ROM, so this is more than a program that imitates calculator answers. It is also intentionally slow: Carlini describes performance of a few hundred instructions per second, and example calculations in the repository take roughly three to ten minutes on his computer.

What the 4,004-byte program actually emulates

Nicholas Carlini’s article, published August 4, 2025, describes a gate-level emulator for the Intel 4004. Rather than implementing only the CPU’s documented instructions as higher-level software, it models the 4004 as a logic circuit and simulates that circuit. The program also models the Intel 4001, 4002, and 4003 devices used by the calculator system.

That distinction matters: the emulated machine runs the original Busicom 141-PF calculator ROM. The calculator’s behavior comes from that ROM running on the simulated hardware, rather than from a set of newly written arithmetic routines designed to return familiar answers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How the circuit becomes compact C

The design starts with a large circuit, then compresses its representation and the surrounding logic into C. Carlini says he used miniHDL to design the circuit before reducing the generated structure to fit the byte limit. The code is deliberately difficult to read; the size target favors compact representation over maintainability.

#1 Best Overall
Sale
Casio fx-9750GIII Graphing Calculator, Python Programming, Black
  • USER-FRIENDLY DISPLAY – Natural Textbook Display℠ shows expressions and results exactly as they appear in textbooks, simplifying writing and interpreting complex math.
  • STUDENT FRIENDLY - Combines ease of use with advanced functionality—ideal for courses from Pre-Algebra to AP Statistics. Supports graph plotting, vectors, probability distributions, spreadsheets, eActivities, integrals, and more for a full range of math and science applications.
  • PYTHON INTEGRATION – Program with MicroPython directly on the calculator, or connect to a PC to transfer, store, or share your programs.
  • EXAM-APPROVED – Approved for use in AP, SAT, ACT, IB, and other standardized exams, making it a reliable choice for students.
  • USB CONNECTIVITY: Easily store and transfer files to and from a computer using the included USB cable.

Micro-operations represent each instruction

The 4004 is microcoded in this implementation: an instruction can be represented by as many as 16 micro-operations. A four-bit counter tracks which micro-operation is current, while a 96-bit shift register stores the micro-operation vector.

Memory and arithmetic are modeled as hardware

The ROM is divided into program and lookup-table banks, and the arithmetic logic unit is implemented as a three-deep queue. These are parts of the emulator’s circuit model, not evidence that the program merely looks up calculator answers.

Rank #2
HP Prime G2 Graphing Calculator – Multi-Touch 3.5" Color Display CAS Exam Approved SAT/AP/IB Scientific Calculator for School, Highschool, College Students – Programmable, 256MB, Includes Case + Cloth
  • ADVANCED GRAPHING & CAS – Explore complex math with computer algebra system, dynamic geometry, advanced graphing, and spreadsheet applications plus RPN. This color graphing calculator lets you switch between symbolic, graphical, and numerical views with dedicated keys.
  • 3.5-INCH MULTI-TOUCH COLOR DISPLAY – Graphing scientific calculator with a large high-resolution color screen, pinch-to-zoom, interactive graph manipulation, and customizable backgrounds. Add background images and use your finger to sketch and adjust functions for blended learning.
  • EXAM APPROVED & CLASSROOM READY – Approved for PSAT/NMSQT, SAT, IB, and select AP exams. Suitable as an SAT calculator, statistics calculator, calculus calculator, precalculus calculator, engineering calculator for college, algebra calculator, or geometry calculator.
  • WIRELESS & APP INTEGRATION – Use HP Prime Wireless + Connectivity Kits to poll students, share data, and project screens. HP Prime Mobile App (Windows, iOS, Android) mirrors full calculator functionality. Brushed metal design includes a slide-on cover and rechargeable lithium-ion battery.
  • EXPANDABLE MEMORY & STEM ECOSYSTEM – 256 MB flash memory stores programs, exam configurations, and images. Integrates with optional accessories for advanced classroom control, real-time collaboration, and interactive engagement across the complete HP STEM environment.

There are two source-size figures

The 4,004-byte figure refers to the compact variant. The repository also preserves the IOCCC contest form; these are related versions, not two measurements of the same unchanged file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Variant Reported size What the figure means
Compact 4004-byte variant 4,004 bytes The compact C program after the repository’s size-reduction tweaks.
IOCCC form 4,993 bytes; 2,503 non-whitespace bytes The repository’s contest form before the tweaks that produced the 4,004-byte program.

What you can do with it

The calculator ROM accepts calculator-style key sequences, not modern command-line expressions. In the repository’s examples, 2+3+= returns 5 and 85*72= returns 6120. The examples also cover division, memory operations, square roots, and subtotals. In other words, the characters represent keys pressed on the original calculator interface; they are not a general-purpose expression language.

Rank #3
Texas Instruments TI-84 Plus CE Color Graphing Calculator, Black
  • Makes understanding math and science topics quicker and easier — ideal for middle school through college
  • Built-in MathPrint feature allows you to input and view math symbols, formulas and stacked fractions exactly as they appear in textbooks
  • Graph in vibrant colors to make faster, stronger connections. Powered by a TI Rechargeable Battery that can last up to one month on a single charge.
  • 4-year subscription for the TI-84 Plus CE online calculator included with purchase
  • Lightweight yet durable enough to withstand the demands of the classroom year after year

The repository preserves the project and lists example calculations. To try it, use that repository’s build and run instructions rather than assuming a generic calculator command or input format: no specific compiler command or operating-system requirement is established here.

Why it runs slowly

A gate-level simulation does much more work than simply executing each calculator instruction in a conventional emulator. Carlini describes the result as running at a few hundred instructions per second and usable “just as long as you’re not in a hurry.” The repository estimates roughly three to ten minutes for some example calculations on Carlini’s computer; that is an approximate, machine-specific runtime, not a guarantee for every system or input.

Rank #4
Sale
Texas Instruments TI-Nspire CX II CAS Color Graphing Calculator with Student Software (PC/Mac)
  • Color Screen. The screen size is 320 x 240 pixels (3.5 inches diagonal) and the screen resolution is 125 DPI; 16-bit color
  • Rechargeable battery included. Can last up to two weeks on a single charge
  • Handheld-Software Bundle. Includes the TI-Inspire CX Student Software delivering enhanced graphing capabilities and other functionality.
  • Thin Design and lightweight with easy touchpad navigation.Quick alpha keys
  • Six different graph styles and 15 colors to select from for differentiating the look of each graph drawn

The original ROM can buffer only a limited number of keystrokes. The repository also warns that timing race conditions—harmless on the much faster physical calculator—can matter in the slow emulation. If a long sequence behaves unexpectedly, try shorter key sequences rather than treating the program like an interactive modern calculator that can accept an unlimited input line.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why this is an IOCCC project

Carlini wrote the project for the 28th International Obfuscated C Code Contest (IOCCC) in 2025. The official entry awarded it “Prize in perfect timing”; the judges specifically noted that they were impressed it simulated the drum printer. The preserved contest version and the compact 4,004-byte variant show two different aspects of the project: its IOCCC submission and a further-compressed form.

Best Value
Sale
TI-84 Evo Graphing Calculator Texas Instruments, White
  • Newest in the TI-84 series: Built for everyday classroom use
  • Icon-based home screen: Popular math tools are front and center for faster, more intuitive navigation
  • 3x faster performance: A powerful processor delivers quicker calculations and smoother graphing
  • Bigger, clearer graphs: 50% more graphing space makes it easier to see patterns and relationships
  • Simplified keypad design: Larger buttons and reduced clutter help you work faster with fewer steps

A separate official bug page documents a zero-printing defect in a related Carlini program from 2024, where a 0 digit can print as a space. That report is about the 2024 program; it does not establish that the 4,004-byte 4004 calculator has the same defect.

Quick Recap

Bestseller No. 3
Texas Instruments TI-84 Plus CE Color Graphing Calculator, Black
Texas Instruments TI-84 Plus CE Color Graphing Calculator, Black
4-year subscription for the TI-84 Plus CE online calculator included with purchase; Lightweight yet durable enough to withstand the demands of the classroom year after year
$110.59
SaleBestseller No. 4
Texas Instruments TI-Nspire CX II CAS Color Graphing Calculator with Student Software (PC/Mac)
Texas Instruments TI-Nspire CX II CAS Color Graphing Calculator with Student Software (PC/Mac)
Rechargeable battery included. Can last up to two weeks on a single charge; Thin Design and lightweight with easy touchpad navigation.Quick alpha keys
$155.99
SaleBestseller No. 5
TI-84 Evo Graphing Calculator Texas Instruments, White
TI-84 Evo Graphing Calculator Texas Instruments, White
Newest in the TI-84 series: Built for everyday classroom use
$82.00

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.