Attention!
Do you want to be the best mathematician?Here's a new method to beat a sequential search that goes from 0 to N-1 !
It's called sequential-advanced, and it's based on solid mathematical and probabilistic theories. In fact, the probability that it does not find the key before the classic sequential method is 1/N that's 1/2^68 if we look at puzzle 69, almost zero!!
This means that, compared to the classic sequential search, the advanced method will find the key first in 99.99999999% of cases! Incredible.
But let's put it to the test with a script
import hashlib
import random
import time
TOTAL_SIZE = 10000
SIMULATIONS = 500
def generate_h160(data):
return hashlib.new('ripemd160', str(data).encode()).hexdigest()
def sequential(dataset, target_hash):
checks = 0
for i in range(len(dataset)):
checks += 1
if generate_h160(dataset[i]) == target_hash:
return {"checks": checks, "found": True}
return {"checks": checks, "found": False}
def sequential_advanced(dataset, target_hash):
checks = 0
for i in range(1, len(dataset)):
checks += 1
if generate_h160(dataset[i]) == target_hash:
return {"checks": checks, "found": True}
checks += 1 # check 0 at the end
if generate_h160(dataset[0]) == target_hash:
return {"checks": checks, "found": True}
return {"checks": checks, "found": False}
def compare_methods():
results = {
"sequential": {"wins": 0, "total_checks": 0, "total_time": 0},
"sequential_advanced": {"wins": 0, "total_checks": 0, "total_time": 0},
"ties": 0
}
for i in range(SIMULATIONS):
dataset = list(range(TOTAL_SIZE))
random.shuffle(dataset)
target = random.choice(dataset)
target_hash = generate_h160(target)
start = time.perf_counter()
res_seq = sequential(dataset, target_hash)
time_seq = time.perf_counter() - start
start = time.perf_counter()
res_adv = sequential_advanced(dataset, target_hash)
time_adv = time.perf_counter() - start
results["sequential"]["total_checks"] += res_seq["checks"]
results["sequential_advanced"]["total_checks"] += res_adv["checks"]
results["sequential"]["total_time"] += time_seq
results["sequential_advanced"]["total_time"] += time_adv
if res_seq["checks"] < res_adv["checks"]:
results["sequential"]["wins"] += 1
elif res_seq["checks"] > res_adv["checks"]:
results["sequential_advanced"]["wins"] += 1
else:
results["ties"] += 1
print(f"Simulation {i+1}: Sequential = {res_seq['checks']} checks in {time_seq:.6f}s | Sequential-Advanced = {res_adv['checks']} checks in {time_adv:.6f}s")
# Calcolo medie
avg_time_seq = results["sequential"]["total_time"] results["sequential"]["wins"] if results["sequential"]["wins"] > 0 else float('inf')
avg_time_adv = results["sequential_advanced"]["total_time"] results["sequential_advanced"]["wins"] if results["sequential_advanced"]["wins"] > 0 else float('inf')
avg_checks_seq = results["sequential"]["total_checks"] results["sequential"]["wins"] if results["sequential"]["wins"] > 0 else float('inf')
avg_checks_adv = results["sequential_advanced"]["total_checks"] results["sequential_advanced"]["wins"] if results["sequential_advanced"]["wins"] > 0 else float('inf')
print(f"""
=== FINAL RESULTS ===
Wins:
Sequential: {results['sequential']['wins']}
Sequential-Advanced: {results['sequential_advanced']['wins']}
Ties: {results['ties']}
Total Checks:
Sequential: {results['sequential']['total_checks']}
Sequential-Advanced: {results['sequential_advanced']['total_checks']}
Total Time:
Sequential: {results['sequential']['total_time']:.6f} seconds
Sequential-Advanced: {results['sequential_advanced']['total_time']:.6f} seconds
Averages (Total Time Wins):
Sequential : {avg_time_seq:.6f} seconds/victory
Sequential-Advanced : {avg_time_adv:.6f} seconds/victory
Checks per Win:
Sequential : {avg_checks_seq:.2f} checks/win
Sequential-Advanced : {avg_checks_adv:.2f} checks/win
""")
if __name__ == '__main__':
compare_methods()
Result:
=== FINAL RESULTS ===
Wins:
Sequential: 0
Sequential-Advanced: 500
Ties: 0
Total Checks:
Sequential: 2397028
Sequential-Advanced: 2396528
Total Time:
Sequential: 15.394807 seconds
Sequential-Advanced: 12.848593 seconds
Averages (Total Time Wins):
Sequential : inf seconds/victory
Sequential-Advanced : 0.025697 seconds/victory
Checks per Win:
Sequential : inf checks/win
Sequential-Advanced : 4793.06 checks/win
Look at that! 500 to 0 unbelievable, right? Never use the normal sequential search again.
And dont use the prefix-method either, because against the original sequential approach, you might lose sometimes.
With this new method, instead, youre practically unbeatable!
But how does it work?
Simple: the advanced method searches sequentially starting from 1 instead of 0, and it checks 0 only at the end.
Checkmate to the sequential method from 0 to N-1!
I've found a method that retires it one that lets me find the key faster in 99.999999% of cases.
Right?
Puzzle 69 solved as soon as I posted 100% winrate method. Will accept donation too