This commit is contained in:
2025-09-11 20:19:27 +02:00
parent 2ed82171af
commit 1a3f5bb015
2 changed files with 40 additions and 48 deletions

View File

@@ -1,10 +1,10 @@
#![allow(dead_code)] #![allow(dead_code)]
use lazy_static::lazy_static;
use lib::submit;
use std::fs::File; use std::fs::File;
use std::io::{BufRead, BufReader}; use std::io::{BufRead, BufReader};
use std::str::FromStr; use std::str::FromStr;
use lazy_static::lazy_static;
use lib::compute_async;
lazy_static!( lazy_static!(
static ref DATA: Vec<u64> = { static ref DATA: Vec<u64> = {
@@ -19,54 +19,41 @@ lazy_static!(
}; };
); );
const FG_DATA_EVEN: &[u64] = &[ const N: u64 = 979607657800000055;
0, 0, 0, 0, const X: u64 = 10962444957429324784;
0, 0, 0, 18446744073709551615,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 131072, 18446744073709551615,
];
const FG_DATA_ODD: &[u64] = &[131072, 18446744073709551615];
const N: u64 = 10000117800000000;
const X: u64 = 5905739161907566595;
fn main() { fn main() {
compute_async(|tx| { fn sum(n: u64, k: u64) -> u64 {
let mut sum = 0u64;
for i in 1..=k {
sum = add(sum, fg_n(n + i, k - i));
}
sum
}
fn fast_sum(n: u64, k: u64) -> u64 {
debug_assert!(k % 192 == 0);
let mut result = sum(n, 0);
result = add(result, ((13556435138434861179u128 * (k / 192) as u128) % (u64::MAX as u128)) as u64);
result
}
let mut n = N; let mut n = N;
let mut x = X; let mut x = X;
loop {
n += 1; n += 1;
x = sub(f(x), n); x = sub(f(x), n);
fn foo(n: u64, mut x: u64, k: u64) -> (u64, u64) { let k = (1_000_000_000_000_000_000u64 - n) / 192 * 192;
for i in 1..=k { let sum = fast_sum(n , k);
x = sub(fg(x), n + i); x = sub(fg_n(x, k), sum);
} n += k;
(n + k, x)
}
(n, x) = foo(n, x, 1_000_000);
x = g(x); x = g(x);
tx.send((n, x)).unwrap(); submit(n, x).unwrap();
} println!("n = {n}");
}); println!("x = {x}");
} }
fn f(x: u64) -> u64 { fn f(x: u64) -> u64 {
@@ -95,7 +82,7 @@ fn fg(x: u64) -> u64 {
} }
fn fg_n(mut x: u64, n: u64) -> u64 { fn fg_n(mut x: u64, n: u64) -> u64 {
for _ in 0..n { for _ in 0..n%64 {
x = fg(x); x = fg(x);
} }
x x

View File

@@ -0,0 +1,5 @@
// https://button.qedaka.de/08_revisit_everything.html?name=Jonah&n=1000000000000000001&x=1141722273008339915328938587151716754833048258848475681487735516970602226114183939065675583898686553774198065467756506859865498694600744286363279646703886300858182075206964546562179673525530750445867781284063290359534951870422248538689162221
fn main() {
}