────────────
INSTRUCTIONS
────────────
 
The calculator operates on the NUMBER IN MEMORY (Current Number).
Use "Start Generation", "Verify number from File", or "Load NUMBER"
to load a number first.
 
────────────────────────────────────
OPERAND MODE — "Calc with:"
────────────────────────────────────
The radio buttons next to "Calc with:" define what value is used
as the second operand in all calculator operations:
 
  ( ) Operand
    Uses the value typed in the Operand field (up to 10,000 digits).
    Default value: 2.
    Buttons 1 and 2 set the operand instantly with one click.
    Paste, Clear, and Copy buttons are available in this mode.
 
  ( ) Memory [M]
    Uses the number stored in calculator memory (via the M button)
    as the operand. The field turns red showing the stored value.
    Paste, Clear, and Copy buttons are hidden in this mode.
    Calculator memory must be loaded first using the M button.
    This allows operations between two large BigInt numbers —
    for example, dividing a number with millions of digits
    by another number with millions of digits.
 
────────────────────────────────────
AUTO UNDO AND UNDO
────────────────────────────────────
AUTO UNDO (checkbox)
  When active: each operation shows the result but restores
  the original number in memory automatically.
  When inactive: each operation permanently changes the number in memory.
 
UNDO LAST CALCULATION (button)
  Restores the previous number regardless of Auto Undo state.
 
────────────────────────────────────
CURRENT DIGIT COUNT
────────────────────────────────────
  Shows the number of digits of the number currently in memory.
  Updated automatically after each operation.
 
────────────────────────────────────
ARITHMETIC OPERATIONS
────────────────────────────────────
ADD        Adds the operand to the number in memory.
SUBTRACT   Subtracts the operand from the number in memory.
MULTIPLY   Multiplies the number in memory by the operand.
DIVIDE     Divides the number in memory by the operand (integer division).
MOD        Returns the remainder of the division by the operand.
+UI        Fast addition using the operand as a small integer.
 
────────────────────────────────────
POWER AND ROOTS
────────────────────────────────────
POWER      Raises the number in memory to the power of the operand.
           Warning shown if result exceeds 10,000,000 digits.
           Operand is automatically reduced to 100 if larger.
 
ROOT       Calculates the N-th root (N = operand, minimum 2).
           Operand is reduced to 1000 if larger.
           Shows "(exact!)" if the root is mathematically exact.
 
ROOTREM    Calculates the integer N-th root AND the remainder.
           (N = operand, minimum 2, maximum 1000).
           Shows "(exact root!)" if exact, or "rem=XXXX" with the
           remainder value when the root is not exact.
           Useful to verify: number = root^N + remainder.
 
────────────────────────────────────
SHIFT OPERATIONS
────────────────────────────────────
SHIFT LEFT   Multiplies by 2^N (N = operand). Equivalent to N left bit shifts.
SHIFT RIGHT  Divides by 2^N (N = operand). Equivalent to N right bit shifts.
X 10         Appends a zero to the right (multiplies by 10). Instantaneous.
/ 10         Removes the last digit (divides by 10). Instantaneous.
 
────────────────────────────────────
NUMBER THEORY
────────────────────────────────────
GCD        Greatest Common Divisor between the number in memory
           and the operand. Same as GCF (Greatest Common Factor).
 
GCF M      Greatest Common Divisor between the number in memory
           and the number stored in calculator memory (M button).
           Calculator memory must be loaded first using the M button.
 
LCM        Least Common Multiple between the number in memory
           and the operand.
 
────────────────────────────────────
STRING OPERATIONS (instantaneous)
────────────────────────────────────
REVERSE    Reverses all digits of the number. Example: 12345 -> 54321.
CONCAT     Appends the operand digits to the right of the number in memory.
           Example: number=1234, operand=5678 -> result=12345678.
 
────────────────────────────────────
PRIME OPERATIONS
────────────────────────────────────
PREVP      Finds the previous prime number before the number in memory.
           Warning shown for numbers with more than 10,000 digits.
           Uses background threading — STOP button is active during search.
           Time limit is controlled by "Internal limit in minutes".
 
NEXTP      Finds the next prime number after the number in memory.
           Warning shown for numbers with more than 10,000 digits.
           Uses background threading — STOP button is active during search.
           Time limit is controlled by "Internal limit in minutes".
 
────────────────────────────────────
PRP TEST — Run> PRP/Pfgw
────────────────────────────────────
  Runs a primality test on the number currently in memory using the
  external PFGW tool (pfgw64_133mm.exe), which must be present in
  the program's directory.
 
  PFGW (PrimeForm/GW) is an open-source primality testing tool
  developed by George Woltman and contributors.
  Source: https://sourceforge.net/projects/openpfgw/
 
  Select the test mode using the dropdown next to the button:
 
  Trial division only (fast)
    Checks only for small prime factors. Very fast for composites
    with small factors. Does NOT perform a full primality test.
    Note: this mode may cause the main window to become
    unresponsive during processing. This is normal — the STOP
    button remains active. Use "PRP test only" if you need the
    interface fully responsive during the test.
 
  PRP test only (no trial div)     [default]
    Skips trial division and performs a full Probable Prime test
    directly. Best for numbers already pre-filtered by the program.
    The main window remains fully responsive during this test.
 
  Trial + PRP (complete)
    Performs trial division followed by a full PRP test.
    Most thorough option. May cause temporary unresponsiveness
    during the trial division phase.
 
  Trial only - extended to 10^9
    Checks for prime factors up to 1,000,000,000.
    Takes significantly longer but provides deep factor coverage.
    May cause temporary unresponsiveness during processing.
 
  PRP multi-base 2+3+5
    Performs PRP test in base 2, then repeats in base 3 and base 5
    for additional confidence. Run separately for each base.
 
  PRP base 3 only / PRP base 5 only
    Alternative bases for PRP testing. Use after base 2 to increase
    confidence that the number is genuinely prime.
 
  Mersenne LL test (deterministic)
    For Mersenne-form numbers (2^p - 1) only.
    Uses the Lucas-Lehmer method. Only available when Mersenne
    mode is active. Provides stronger evidence than a standard PRP.
 
  Factor deep scan to 10^9
    Exhaustive factor search up to 10^9, listing all factors found.
    Use -d flag internally to continue past the first factor found.
 
  Results shown:
    "is 3-PRP!"           — probable prime in base 3
    "is 2-PRP!"           — probable prime in base 2
    "is composite"        — definitively not prime
    "has no small factor" — no factor found up to the specified limit
    "has factors: X"      — factor X was found
 
  The elapsed time is shown during the test and recorded in the result.
  Use the STOP checkbox to abort the test at any time.
 
  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.
 
────────────────────────────────────
YOUR SIGNATURE — Embedding a personal message
────────────────────────────────────
  The "Your signature" field allows you to embed a personal message
  permanently inside the prime number itself.
 
  Type any text (up to 60 characters) in the field before generation.
  The message is automatically encoded as ASCII codes and written
  into the prime number starting at the second digit position.
  It is wrapped between two pipe markers | so it can always be
  decoded unambiguously.
 
  HOW THE ENCODING WORKS:
 
  Every character is converted to its 3-digit ASCII code and
  written directly into the number. Example with "John - May 2026":
 
    Character  ASCII  Code
    J          74     074
    o          111    111
    h          104    104
    n          110    110
    (space)    32     032
    -          45     045
    (space)    32     032
    M          77     077
    a          97     097
    y          121    121
    (space)    32     032
    2          50     050
    0          48     048
    2          50     050
    6          54     054
 
  The resulting prime number starts with:
    7 | 124 074 111 104 110 032 045 032 077 097 121 032 050 048 050 054 124 | ...
    ^   ^                                                                   ^
    |   opening marker (ASCII 124 = |)                         closing marker
    first valid digit chosen by generation rules
 
  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 0 9 7 ...
 
  READING THE SIGNATURE:
  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 for easy reference.
 
  To decode manually:
    1. Skip the first digit
    2. Read groups of 3 digits
    3. Find the opening 124 marker
    4. Convert each group of 3 digits to its ASCII character
    5. Stop at the closing 124 marker
 
  This signature is mathematically permanent — it is an integral
  part of the prime number itself. Anyone who receives the number
  can verify and read the signature simply by reading the digits.
  The number is genuinely prime AND carries your personal mark.
 
  Accented characters (á, é, ç, ñ, etc.) are automatically
  converted to their unaccented equivalents before encoding.
 
────────────────────────────────────
CALCULATOR MEMORY BUTTONS
────────────────────────────────────
M          Stores the current number in memory (shown in red when active).
           Used by GCF M and by "Calc with: Memory [M]" mode.
 
MR         Retrieves the number stored in M back to active memory.
           The previous active number is saved for Undo.
 
MC         Clears only the calculator memory (sets M to zero).
           Does not affect the current number or operand.
 
M+         Adds the current number in memory to the stored M value.
           Shows the new digit count of M after the operation.
 
M-         Subtracts the current number from the stored M value.
           Result is always positive (ABS applied automatically).
           Shows the new digit count of M after the operation.
 
M<>D       Swaps the current number (Display) with the calculator memory (M).
           Useful when you need to reverse the order of an operation.
           Example: load A, press M, load B, press M<>D,
           now A is active and B is in memory — ready for A divided by B.
 
C          Clears everything: current number, calculator memory,
           and resets the operand to 2. Also clears Undo history.
           Use this to start fresh.
 
────────────────────────────────────
SAVE AND VIEW
────────────────────────────────────
SAVE NUMBER  Saves the current number in memory to a TXT file.
 
LOAD NUMBER  Loads a number from a TXT file directly into memory.
             The file must contain only digits, no spaces or blank lines.
 
VIEW         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         Copies the current number in memory to the clipboard.
(next to      Follows the same size limit as the View function.
 View)        For very large numbers, use Save NUMBER instead.
 
IS P?        Quick primality test. See ANALYSIS section above.
 
────────────────────────────────────
YOUR NUMBER FIELD BUTTONS
────────────────────────────────────
The "Your Number" field accepts a number typed or pasted manually
(up to 10,000 digits). The following buttons act on this field:
 
< Check   Validates the number and loads it into calculator memory
          after performing primality pre-checks.
 
Paste     Pastes a number from the clipboard into the field.
 
Copy      Copies the contents of the Your Number field to the clipboard.
 
C         Clears the Your Number field.
 
M         Loads the number from the Your Number field directly into
          calculator memory, without full validation checks.
          Useful for quick loading of known numbers.
 
>>D       Loads the number from the Your Number field directly into
          the Display (current number), bypassing the verification step.
          Useful when you already know the number is valid and want
          to use it immediately in calculator operations.
 
────────────────────────────────────
NOTES
────────────────────────────────────
* All operations work with numbers of arbitrary size (BigInt via GMP).
* Maximum supported 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.
* The operand field accepts numbers up to 10,000 digits.
* In Memory [M] mode, operations use the stored M value as operand,
  allowing BigInt x BigInt calculations of any size.
* Division always returns the integer part (floor division).
* Auto Undo is active by default — disable it to accumulate operations.
* For prime testing on large numbers, use Run> PRP/Pfgw for a rigorous
  PRP test, or "Verify number from File" for a quick pre-check.
* The Analyze function uses optimized ASM code and runs in under
  1 second even for numbers with 45 million digits.
* Time limits for long operations are set via "Internal limit in minutes"
  in the Limits >Caution!< menu.
* Trial division modes in Run> PRP/Pfgw may cause the main window to
  become temporarily unresponsive. This is normal behavior — use
  "PRP test only" mode for a fully responsive interface.
