Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
viljy
on 06/05/2024, 12:04:04 UTC
are close to 0% of the total possible different patterns

Interestingly, the content of such numbers increases with the growth and height of the range.

Quote
============================= RESTART: D:\NumHex.py ============================
In the range from 0x1000 to 0x2000, 1 hexadecimal numbers were found with repeating digits occurring four or more times in a row.
This accounts for 0.02% of the total hexadecimal numbers in the range.

============================= RESTART: D:\NumHex.py ============================
In the range from 0x10000 to 0x20000, 32 hexadecimal numbers were found with repeating digits occurring four or more times in a row.
This accounts for 0.05% of the total hexadecimal numbers in the range.

============================= RESTART: D:\NumHex.py ============================
In the range from 0x100000 to 0x200000, 737 hexadecimal numbers were found with repeating digits occurring four or more times in a row.
This accounts for 0.07% of the total hexadecimal numbers in the range.

============================= RESTART: D:\NumHex.py ============================
In the range from 0x1000000 to 0x2000000, 15617 hexadecimal numbers were found with repeating digits occurring four or more times in a row.
This accounts for 0.09% of the total hexadecimal numbers in the range.

============================= RESTART: D:\NumHex.py ============================
In the range from 0x10000000 to 0x20000000, 311282 hexadecimal numbers were found with repeating digits occurring four or more times in a row.
This accounts for 0.12% of the total hexadecimal numbers in the range.

============================= RESTART: D:\NumHex.py ============================
In the range from 0x100000000 to 0x200000000, 5963072 hexadecimal numbers were found with repeating digits occurring four or more times in a row.
This accounts for 0.14% of the total hexadecimal numbers in the range.

Anyone who wishes can calculate independently in the 130 range, but it will be a very long time:

Code:
def count_repeated_digits_hex(start, end):
    count = 0
    total_nums = int(end, 16) - int(start, 16) + 1

    def has_repeated_digits(num_str):
        prev_digit = None
        consecutive_count = 0

        for digit in num_str:
            if digit == prev_digit:
                consecutive_count += 1
            else:
                consecutive_count = 1

            if consecutive_count >= 4:
                return True

            prev_digit = digit

        return False

    for num in range(int(start, 16), int(end, 16) + 1):
        num_str = hex(num)[2:]  # Remove '0x' prefix
        if has_repeated_digits(num_str):
            count += 1

    percentage = (count / total_nums) * 100

    return count, percentage

start = "0x100000000"
end = "0x200000000"
result, percentage = count_repeated_digits_hex(start, end)
print(f"In the range from {start} to {end}, {result} hexadecimal numbers were found with repeating digits occurring four or more times in a row.")
print(f"This accounts for {percentage:.2f}% of the total hexadecimal numbers in the range.")