Gunakan SH-256 top 50 4D dan buatkan scriptnya unt...
Creato il: 31 maggio 2026
Risposto usando GPT-5.5 Thinking da Chat01
Creato il: 31 maggio 2026
Risposto usando GPT-5.5 Thinking da Chat01
Gunakan SH-256 top 50 4D dan buatkan scriptnya untuk di jalankan di google colab
Berikut script Google Colab untuk membuat Top 50 angka 4D menggunakan SHA-256 dari file PRIZE.txt. File kamu berisi format tanggal/waktu dan baris angka 4D seperti 6112, 0236, dst. (PRIZE.txt)
Catatan: SHA-256 ini bukan prediksi pasti, hanya ranking deterministik berbasis data historis + hash. Hasil akan sama selama file dan parameter sama.
python# ========================= # SHA-256 TOP 50 4D COLAB # ========================= import re import hashlib import pandas as pd from collections import Counter from google.colab import files # 1) Upload file PRIZE.txt uploaded = files.upload() # Ambil nama file pertama yang di-upload filename = list(uploaded.keys())[0] print("File terbaca:", filename) # 2) Baca isi file with open(filename, "r", encoding="utf-8", errors="ignore") as f: text = f.read() # 3) Parsing angka 4D # Format yang dicari: # 6112 0, 3, 4, 5, 7, 8, 9 # 0236 1, 4, 5, 7, 8, 9 pattern = re.compile(r"^\s*(\d{4})\s+(?:\d\s*,?\s*)+", re.MULTILINE) numbers = pattern.findall(text) # Hapus duplikat parsing yang aneh, tapi tetap pertahankan urutan asli numbers = [n.zfill(4) for n in numbers] print("Total angka 4D terbaca:", len(numbers)) print("Contoh 10 angka terakhir:", numbers[-10:]) if len(numbers) == 0: raise ValueError("Tidak ada angka 4D yang berhasil dibaca. Cek format file PRIZE.txt.") # ========================= # KONFIGURASI # ========================= TOP_N = 50 # Berapa data terakhir yang dipakai sebagai seed SHA-256 LAST_N_SEED = 200 # Pilihan mode: # "sha256" = ranking murni SHA-256 # "hybrid" = SHA-256 + statistik posisi digit + penalti angka yang baru keluar MODE = "sha256" # ========================= # MEMBUAT SEED DARI DATA HISTORIS # ========================= recent_seed_data = numbers[-LAST_N_SEED:] seed_text = "|".join(recent_seed_data) seed_hash = hashlib.sha256(seed_text.encode()).hexdigest() print("Seed SHA-256:") print(seed_hash) # ========================= # FUNGSI SCORE SHA-256 # ========================= def sha256_score(candidate, seed_hash): raw = f"{seed_hash}|{candidate}" digest = hashlib.sha256(raw.encode()).hexdigest() score = int(digest, 16) return score, digest # ========================= # OPSIONAL: SCORE STATISTIK HYBRID # ========================= def build_position_stats(data): pos_counts = [Counter() for _ in range(4)] for num in data: for i, d in enumerate(num): pos_counts[i][d] += 1 return pos_counts def position_score(candidate, pos_counts, total): score = 0 for i, d in enumerate(candidate): # Laplace smoothing agar digit yang belum muncul tetap punya nilai score += (pos_counts[i][d] + 1) / (total + 10) return score / 4 recent_stats_data = numbers[-300:] if len(numbers) >= 300 else numbers pos_counts = build_position_stats(recent_stats_data) recent_exact = set(numbers[-100:]) # ========================= # GENERATE SEMUA ANGKA 0000 - 9999 # ========================= candidates = [f"{i:04d}" for i in range(10000)] rows = [] for cand in candidates: hash_score, digest = sha256_score(cand, seed_hash) if MODE == "sha256": final_score = hash_score elif MODE == "hybrid": # Normalisasi SHA score ke 0 - 1 hash_norm = hash_score / ((1 << 256) - 1) # Statistik posisi digit pos_norm = position_score(cand, pos_counts, len(recent_stats_data)) # Penalti jika angka sudah muncul sangat baru repeat_penalty = 0.85 if cand in recent_exact else 1.0 # Bobot hybrid final_score = ( 0.70 * hash_norm + 0.30 * pos_norm ) * repeat_penalty else: raise ValueError("MODE harus 'sha256' atau 'hybrid'.") rows.append({ "rank_score": final_score, "angka_4d": cand, "sha256": digest, "pernah_muncul": cand in set(numbers), "muncul_100_terakhir": cand in recent_exact }) # ========================= # SORTING TOP 50 # ========================= df = pd.DataFrame(rows) df = df.sort_values("rank_score", ascending=False).reset_index(drop=True) top50 = df.head(TOP_N).copy() top50.insert(0, "rank", range(1, TOP_N + 1)) # Tampilkan hasil top50_display = top50[[ "rank", "angka_4d", "rank_score", "pernah_muncul", "muncul_100_terakhir", "sha256" ]] pd.set_option("display.max_colwidth", 80) display(top50_display) # ========================= # SIMPAN KE CSV # ========================= output_file = "top50_4d_sha256.csv" top50_display.to_csv(output_file, index=False) print("File hasil disimpan:", output_file) # Download otomatis files.download(output_file)
Untuk mode murni SHA-256, biarkan:
pythonMODE = "sha256"
Kalau ingin ranking yang digabung dengan pola statistik posisi digit, ubah menjadi:
pythonMODE = "hybrid"