VILLANOVA - Prime Number Generator & Calculator User Manual - https://www.fernandovillanova.com.br/primes ════════════════════════════════════════════════════════════════════════════════ LOADING A NUMBER INTO MEMORY ───────────────────────────── There are five ways to load a number into the program's memory: 1. MANUAL ENTRY Type a number directly into the "Your Number" field and click "< Check". The program performs basic validation depending on the number's size and places it in memory if valid. 2. FROM FILE Click "Verify number from File" to load a number stored in a TXT file. The same basic checks are performed before placing it in memory. 3. FROM CLIPBOARD Click "Verify number ClipBoard" to load a number from the clipboard. Useful for testing numbers copied from other sources. 4. GENERATION Define the desired number of digits in the "Total digits" field and click "START Generation". The program respects the settings defined in "Valid final digits" and "Valid starting digits". For numbers with LESS than 10,000 digits: The program performs a straightforward random selection of digits between the valid first and last digit definitions, then applies basic primality checks using probabilistic algorithms such as Baillie-PSW and Miller-Rabin. These are well-established methods for identifying probable primes. For practical purposes the results are reliable — the probability of a composite number passing all tests is extremely small. For numbers with MORE than 10,000 digits: The process is fundamentally different. While the first and last digits are still randomly selected according to user-defined rules, the internal digits go through an intensive generation process. Using the "Segment" size and other parameters defined in the "Define parameters for Generation" section, the program builds the number from right to left. The goal is to create what the author calls "chaos" — defined by the "Level of Chaos" selector. This consists of forcing an atypical distribution of digits throughout the number, deliberately creating statistical anomalies that would be extremely rare in a purely random sequence. This methodology will be detailed in the complete technical documentation. 5. LOAD NUMBER BUTTON Use this button to load a number into the program; it must be a TXT file containing only the digits of the number, without spaces or blank lines. YOUR SIGNATURE — Embedding a personal message in your prime ───────────────────────────────────────────────────────────── The "Your signature" field allows you to embed a personal message permanently inside the prime number itself — before generation begins. Type any text up to 60 characters (name, date, phrase, etc.). The message is encoded as 3-digit ASCII codes and written into the number starting at the second digit, wrapped between pipe markers | (ASCII 124) so it can always be decoded unambiguously. Example — signature: "John - May 2026" Character encoding: J=074 o=111 h=104 n=110 ' '=032 -=045 ' '=032 M=077 a=097 y=121 ' '=032 2=050 0=048 2=050 6=054 The prime number starts with (first digit chosen by generation rules): 7 | 124 074 111 104 110 032 045 032 077 097 121 032 050 048 050 054 124 | ... ^ ^ opening marker | closing marker | In the actual digits of the number: 7 1 2 4 0 7 4 1 1 1 1 0 4 1 1 0 0 3 2 0 4 5 0 3 2 0 7 7 ... The program automatically detects and decodes the signature whenever a number is loaded or generated. The decoded message appears in the blue display at the top and is restored in the "Your signature" field. This signature is mathematically permanent — it is an integral part of the prime number itself, not metadata. Anyone who receives the number can verify and read the signature simply by reading the digits. Accented characters are automatically converted to unaccented equivalents. See the Calculator Help file for full encoding details. HOW THE BLOCK KEY WORKS ──────────────────────── During the generation process, what is actually validated is not the individual digit itself, but the KEY formed by the digits within each analyzed block. Example: consider this block of digits: 037521783 The key that identifies this block and controls its repetition delay is: 01 02 03 05 07 08 00 This key contains 7 two-digit numbers because the block has 7 distinct digits, each represented by its value formatted as a two-digit code, separated by spaces. Note that if the block contains zeros, they always appear at the END of the key — the reason for this will be explained in the technical documentation. These keys are generated continuously and sequentially. Each key is either approved or rejected to form the final number, always applying rules that force atypical frequencies and distributions of occurrences. DISPLAY ──────── The blue field at the top of the calculator section always shows the number currently in memory. If the number contains a signature, the decoded message is shown instead of raw digits at the start. Numbers with up to 99 digits are shown in full; larger numbers show the first and last portions separated by "...". This display updates automatically after every operation. INTERFACE REFERENCE ──────────────────── RESULTS AREA The large panel at the bottom of the screen where the program displays its activities step by step — generation progress, verification results, calculator operations, statistical analysis, and more. This area works as a permanent log of all actions performed. CURRENT DIGIT COUNT Shows the number of digits of the number currently in memory. Updated automatically after every operation. YOUR SIGNATURE Optional personal message embedded into the prime number. See the "YOUR SIGNATURE" section above for full details. MERSENNE? (checkbox) When checked, the generation process searches for Mersenne-form prime candidates (2^p - 1) where p is prime. The "Your signature" field is hidden in this mode since Mersenne numbers have a fixed mathematical form that cannot carry a personal signature. OPERAND FIELD AND "Calc with:" MODE The Operand field is used as the second value in all calculator operations. Default value is 2. Click buttons "1" or "2" to set these common values instantly. The "Calc with:" radio buttons define which value is used as operand: ( ) Operand Uses the value typed in the Operand field (up to 10,000 digits). Paste, Clear, and Copy buttons are available in this mode. ( ) Memory [M] Uses the number stored in calculator memory as the operand. The field turns red and shows the stored M value. This allows operations between two large BigInt numbers — for example, dividing a number with millions of digits by another number with millions of digits. Calculator memory must be loaded first using the M button. AUTO UNDO (checkbox) When active: each calculator operation shows the result in the results area but automatically restores the original number in memory. Useful for exploring results without changing the working number. When inactive: each operation permanently changes the number in memory. UNDO LAST CALCULATION Restores the number that was in memory before the last operation, regardless of the Auto Undo state. SAVE / LOAD (parameters) Save and restore the current screen settings and preferences to a file with the ".fmv" extension. Useful for saving frequently used configurations between sessions. STOP (checkbox) When checked, signals the program to stop the current operation. All heavy operations (generation, prime search, large calculations, PRP test) check this flag regularly. Response is typically immediate. In extreme cases, use Ctrl+Alt+Del to open Task Manager and terminate the program manually. START Generation Begins the number generation process using the current parameters. SAVE NUMBER Saves the number currently in memory to a plain text (.txt) file. LOAD NUMBER Loads a number from a plain text (.txt) file directly into memory. The file must contain only the number digits, without spaces or blank lines. VIEW Number Displays the complete number in the results area, formatted in lines of 122 digits for easy reading. Available only for numbers within the configured digit limit. For larger numbers, use "Save NUMBER" and open with Notepad. COPY (next to View) Copies the current number in memory to the clipboard. Follows the same size limit as the View function. For very large numbers, use Save NUMBER instead. IS P? (Is it Prime?) Performs a quick primality test on the number currently in memory. Uses a GCD pre-filter followed by a probabilistic prime test. Result: "IT COULD BE A PRIME" or "NOT PRIME". Run> PRP/Pfgw Runs a primality test on the number currently in memory using the external PFGW tool (pfgw64_133mm.exe). Select the test mode from the dropdown next to the button. Available modes: Trial division only (fast) — fast composite filter, no full PRP PRP test only (no trial div) — full PRP test, interface stays responsive Trial + PRP (complete) — trial division followed by full PRP Trial only - extended to 10^9 — deep factor search up to 1 billion PRP multi-base 2+3+5 — multiple base PRP for higher confidence PRP base 3 only — PRP in base 3 PRP base 5 only — PRP in base 5 Mersenne LL test — deterministic test for 2^p-1 numbers Factor deep scan to 10^9 — exhaustive factor listing Important: Trial division modes may cause the main window to become temporarily unresponsive during processing. This is expected behavior due to the intensive CPU usage of trial division. The STOP button remains active. Use "PRP test only" for a fully responsive interface. Note: On Windows 11, if the console window does not appear correctly, go to Windows Terminal Settings → Startup → Default terminal application and select "Windows Console Host". On Windows 10 this is not required. The file pfgw64_133mm.exe supports numbers up to 133,000,000 digits. See the README file for technical details about this custom build. YOUR NUMBER FIELD Accepts a number typed or pasted manually (up to 10,000 digits). Buttons on the right side of this field: < Check Validates the number and loads it into calculator memory. Paste Pastes a number from the clipboard into the field. Copy Copies the field contents to the clipboard. C Clears the Your Number field. M Loads the number directly into calculator memory without full validation. Useful for known numbers. >>D Loads the number directly into the Display (current number) bypassing the verification step. Useful when the number is already known to be valid. CALCULATOR MEMORY BUTTONS M Stores the current number in memory (shown in red when active). MR Retrieves M back to active memory. Previous number saved for Undo. MC Clears only the calculator memory. Does not affect current number. M+ Adds the current number to the stored M value. M- Subtracts the current number from M. Result is always positive. M<>D Swaps the current number (Display) with calculator memory (M). Very useful to reverse operand order before an operation. C Clears everything: current number, calculator memory, operand (reset to 2), and Undo history. Full fresh start. LIMITS >Caution!< (dropdown + Apply) Allows advanced users to change internal operating limits. Select a limit from the dropdown, view and edit its current value, then click "Apply" to apply. Each limit has a valid range and the program will warn or reset values outside safe boundaries. Use SAVE after modifying to preserve the new values permanently. Available limits: Large numbers start Digit threshold for switching to heavy generation Digits factorization Maximum digits for the Fact operation Digits view number Maximum digits for the View Number function Limit NextP/PrevP Maximum digits for prime neighbor operations Lines for Excel Maximum rows in Excel export (BIFF2 limit: 16383) Operating number Maximum digits for operand input History lines saved Maximum lines kept in the results area Limit digits generation Global maximum digit limit for generation Internal limit in minutes Time limit for heavy background operations (prime search, large calculations). When exceeded, the operation stops automatically and a new candidate is tried if applicable. Clear results Clears the results area completely. Copy ALL Copies the entire contents of the results area to the clipboard. Copy Line Copies only the currently selected line in the results area. Export to Excel Saves the contents of the results area to an Excel (.xls) file. The program intelligently detects different types of content (statistical tables, analysis results, general information) and formats each section appropriately in the spreadsheet. RETRIEVE SELECTED NUMBER Retrieves a number from the selected line in the results area and places it back into memory for further operations. WEBSITE Opens the program's website in your default browser. USER MANUAL Opens this document. ? ABOUT Displays version information and credits. DIGIT STATISTICS ───────────────── The "< Digit Statistics" button analyzes the frequency and distribution of each digit (0-9) within a defined segment of the number in memory. Segment starting / until Define the range of digit positions to analyze. Default is the full number (1 to total digits). Direction selector Choose "All" for the full number, or a specific range. Statistics are also available in reverse direction — revealing structural patterns from right to left. Output columns: Digit The digit being analyzed (0 through 9). How many times Total occurrences within the segment. Delay Current delay (positions since last occurrence). Minimum Smallest delay observed during analysis. Maximum Largest delay observed during analysis. Performance: the statistics engine uses optimized assembly code and processes 45 million digits in approximately 0.3 seconds. VERIFY NUMBER FROM FILE / CLIPBOARD ───────────────────────────────────── These functions load a number and perform a full verification sequence: First check GCD test against the product of the first 850,000 primes arranged in three layers (up to prime ~13,000,000). This instantly eliminates numbers divisible by any small prime — the fastest possible filter. Final verification Probabilistic prime test using GMP's probab_prime function. Result shown as "APPROVED" (probable prime) or "NOT PRIME". For large numbers with millions of digits, use Run> PRP/Pfgw for a rigorous PRP test directly from the interface. NOTES AND LIMITATIONS ────────────────────── * All internal arithmetic uses arbitrary-precision BigInt (GMP library). * Maximum number size: 78,000,000 digits (configurable via Limits). * Heavy operations run in background threads — the interface stays responsive and the STOP button works during all long operations. * Trial division modes in Run> PRP/Pfgw may cause temporary unresponsiveness. Use "PRP test only" for a fully responsive interface. * Excel export is limited to 16,383 rows (BIFF2 format). * Factorization is practical for numbers up to the configured digit limit. * PRP testing of numbers with millions of digits is performed via the integrated Run> PRP/Pfgw button using pfgw64_133mm.exe. * The last generated number is always saved automatically to "last_number.txt" in the program's directory. * Parameters are saved to ".fmv" files — use SAVE regularly. * Time limits for long operations are set via "Internal limit in minutes" in the Limits >Caution!< menu. * The "Your signature" field embeds a personal message permanently into the prime number. See the YOUR SIGNATURE section for details. ────────────────────────────────────────────────────────────────────────── For calculator functions, click the 'Help' button in the calculator section or open the file 'help_calculator.txt' included with the program. ──────────────────────────────────────────────────────────────────────────