Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
nomachine
on 14/09/2024, 12:37:06 UTC
from the standpoint of probability, this doesn’t seem to mean anything

Here is my prediction script. I have +- 0-40% deviations
With correction factor for puzzle 66
alpha = 2.7931615407112251695923857484645003617613050861

more decimals in correction factor more precise result

Code:
import numpy as np
from mpmath import mp
import argparse

# Set higher decimal precision for mpmath
mp.dps = 60  # Adjust precision as needed

# Target numbers (ordinal, value) up to Puzzle 68
target_numbers = [
    (1, 1), (2, 3), (3, 7), (4, 8), (5, 21), (6, 49), (7, 76), (8, 224), (9, 467), (10, 514),
    (11, 1155), (12, 2683), (13, 5216), (14, 10544), (15, 26867), (16, 51510),
    (17, 95823), (18, 198669), (19, 357535), (20, 863317), (21, 1811764),
    (22, 3007503), (23, 5598802), (24, 14428676), (25, 33185509),
    (26, 54538862), (27, 111949941), (28, 227634408), (29, 400708894),
    (30, 1033162084), (31, 2102388551), (32, 3093472814), (33, 7137437912),
    (34, 14133072157), (35, 20112871792), (36, 42387769980), (37, 100251560595),
    (38, 146971536592), (39, 323724968937), (40, 1003651412950),
    (41, 1458252205147), (42, 2895374552463), (43, 7409811047825),
    (44, 15404761757071), (45, 19996463086597), (46, 51408670348612),
    (47, 119666659114170), (48, 191206974700443), (49, 409118905032525),
    (50, 611140496167764), (51, 2058769515153876), (52, 4216495639600700),
    (53, 6763683971478124), (54, 9974455244496707), (55, 30045390491869460),
    (56, 44218742292676575), (57, 138245758910846492), (58, 199976667976342049),
    (59, 525070384258266191), (60, 1135041350219496382), (61, 1425787542618654982),
    (62, 3908372542507822062), (63, 8993229949524469768),
    (64, 17799667357578236628), (65, 30568377312064202855),
    (66, 46346217550346335726)
]

def main(puzzle_number):
    # Extracting the ordinal (x) and values (y) up to the puzzle before the target puzzle
    if puzzle_number in [x[0] for x in target_numbers]:
        ordinals = np.array([x[0] for x in target_numbers if x[0] < puzzle_number], dtype=float)
        values = np.array([x[1] for x in target_numbers if x[0] < puzzle_number], dtype=float)
    else:
        # Use all available data for prediction if puzzle_number is not in the list
        ordinals = np.array([x[0] for x in target_numbers], dtype=float)
        values = np.array([x[1] for x in target_numbers], dtype=float)

    # Compute log of the values using mpmath for high precision
    log_values = np.array([float(mp.log(val)) for val in values], dtype=float)

    # Introduce weights to give more importance to recent values
    weights = np.linspace(0.5, 1, len(ordinals))  # Linear weighting

    # Perform linear regression on log(values) to fit the exponential model, using weights
    coefficients = np.polyfit(ordinals, log_values, 1, w=weights)

    # Extracting the coefficients
    log_a = coefficients[1]
    log_b = coefficients[0]

    # Convert coefficients back to the exponential form
    a = mp.exp(log_a)
    b = mp.exp(log_b)

    # Correction factor
    alpha = 2.7931615407112251695923857484645003617613050861

    # Predict the value for the given puzzle using the exponential model
    predicted_value = (a * mp.power(b, puzzle_number)) - ((((2 ** puzzle_number) - 1) - (2 ** (puzzle_number - 1))) / alpha)

    # Check if the real value is available
    real_value = None
    if puzzle_number in [x[0] for x in target_numbers]:
        real_value = [x[1] for x in target_numbers if x[0] == puzzle_number][0]

    # Function to format mpmath values to avoid scientific notation
    def format_mp(value, decimals=None):
        if decimals is not None:
            # Use string formatting to keep decimal places without thousands separators
            return f"{float(value):,.{decimals}f}".replace(',', '')
        return mp.nstr(value, mp.dps)

    # Compare the corrected value with the real value for the given puzzle
    if real_value is not None:
        print(f"Puzzle {puzzle_number} Real Value: {format_mp(real_value)}")
    print(f"Puzzle {puzzle_number} Predicted Value: {format_mp(predicted_value, 2)}")

    # Calculate the percentage error in the corrected prediction if real value is available
    if real_value is not None:
        error_percentage = abs((predicted_value - real_value) / real_value) * 100
        print(f"Percentage error in the corrected prediction for Puzzle {puzzle_number}: {format_mp(error_percentage, 2)}%")

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Predict puzzle values based on an exponential model.")
    parser.add_argument("puzzle_number", type=int, help="Puzzle number to predict")
    args = parser.parse_args()
    main(args.puzzle_number)


python3 predict.py 20
Puzzle 20 Real Value: 863317
Puzzle 20 Predicted Value: 580555.48
Percentage error in the corrected prediction for Puzzle 20: 32.75%

python3 predict.py 27
Puzzle 27 Real Value: 111949941
Puzzle 27 Predicted Value: 88704196.49
Percentage error in the corrected prediction for Puzzle 27: 20.76%

python3 predict.py 45
Puzzle 45 Real Value: 19996463086597
Puzzle 45 Predicted Value: 20580213444471.79
Percentage error in the corrected prediction for Puzzle 45: 2.92%

python3 predict.py 50
Puzzle 50 Real Value: 611140496167764
Puzzle 50 Predicted Value: 635143323281525.25
Percentage error in the corrected prediction for Puzzle 50: 3.93%

python3 predict.py 63
Puzzle 63 Real Value: 8993229949524469768
Puzzle 63 Predicted Value: 5468647699742324736.00
Percentage error in the corrected prediction for Puzzle 63: 39.19%

python3 predict.py 66
Puzzle 66 Real Value: 46346217550346335726
Puzzle 66 Predicted Value: 46346217550346338304.00
Percentage error in the corrected prediction for Puzzle 66: 0.00%

python3 predict.py 67
Puzzle 67 Predicted Value: 90626458014188470272.00

This is like looking into a crystal ball. It doesn't mean anything.  Grin