VILLANOVA - Prime Number Generator & Calculator
User Manual - https://www.fernandovillanova.com.br/primes
════════════════════════════════════════════════════════════════════════════════
LOADING A NUMBER INTO MEMORY
─────────────────────────────
There are four 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.
 
 
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 — the first 48 and last 48 digits,
separated by "...". Numbers with up to 99 digits are shown in full.
This is the calculator's main display and 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.
 
"Use value of:" FIELD
  Used exclusively as the operand for arithmetic operations and
  calculator functions. Default value is 2.
  Click buttons "1" or "2" to set these common values instantly.
 
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 generation
  process. Note: in certain processing situations the program may
  not be checking this flag immediately, so there may be a delay.
  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.
 
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.
 
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".
 
LIMITS >Caution!< (dropdown + Modify)
  Allows advanced users to change internal operating limits.
  Select a limit from the dropdown, view and edit its current value,
  then click "Modify" to apply. Each limit has a valid range and
  the program will warn or block 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      Global maximum digit limit for all operations
 
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 111,111 primes.
    This instantly eliminates numbers divisible by any small prime —
    the fastest possible composite 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 the external PFGW
  tool for a rigorous PRP (Probable Prime) test.
  See the website for instructions and download links.
 
 
NOTES AND LIMITATIONS
──────────────────────
  * All internal arithmetic uses arbitrary-precision BigInt (GMP library).
  * Maximum number size: 78,000,000 digits (configurable via Limits).
  * The program is single-threaded; very large operations may take time.
  * Excel export is limited to 16,383 rows (BIFF2 format).
  * Factorization is practical for numbers up to approximately 30 digits.
  * For prime testing of numbers with millions of digits, external tools
    such as PFGW are required. See the website for instructions.
  * 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.
 
 
──────────────────────────────────────────────────────────────────────────
  For calculator functions, click the 'Help' button in the calculator
  section or open the file 'help_calculator.txt' included with the program.
──────────────────────────────────────────────────────────────────────────
