add 08_revisit_everything.rs
This commit is contained in:
@@ -1,5 +1,98 @@
|
||||
#![allow(dead_code)]
|
||||
// https://button.qedaka.de/08_revisit_everything.html?name=Jonah&n=1000000000000000001&x=1141722273008339915328938587151716754833048258848475681487735516970602226114183939065675583898686553774198065467756506859865498694600744286363279646703886300858182075206964546562179673525530750445867781284063290359534951870422248538689162221
|
||||
|
||||
fn main() {
|
||||
// You can change the color of your name without changing your name.
|
||||
|
||||
use std::str::FromStr;
|
||||
use lazy_static::lazy_static;
|
||||
use rug::Integer;
|
||||
use rug::ops::{DivRounding, Pow};
|
||||
use lib::compute_async;
|
||||
|
||||
const N: u128 = 1000000000073185001u128;
|
||||
lazy_static!(
|
||||
static ref X: Integer = Integer::from_str("674404660282415099554286008259705897519728869877764551165256987500863620745793154396934476537394982658025146065927801862469915739446118680825670854157276563716625217760696826462684682154873582522786834148305185591910769146737370100544900325").unwrap();
|
||||
|
||||
static ref M: Vec<Integer> = vec![
|
||||
Integer::from_str("1434008120931012805118743381511953470053626771934922366720474361817092344508461315782084314493561729943207476618986862630642339876124303277669871276872966561372584096756184146218943438497504108129008248947186295903702650936563195517405177267").unwrap(),
|
||||
Integer::from_str("2279983661166952569412337967792106681853682761140508555222469060830820310854240357968620360297575902950280777825697828457195462861233847516393870602678279643129330544204145040751369969379909048248974150190225328726111083312867874886821021103").unwrap(),
|
||||
Integer::from_str("2403618920217682814630057320815015451780244245370783386150600183266752801851444036459202928614238339117073052233115617730895326577436837775969446809467396763885076993639257102975158794586432834588823770619549927566204909745661463923650207527").unwrap(),
|
||||
Integer::from_str("2211546667714470043261801539278553165605603776798179390251801872528197206642136833266100994696226928008915728096531663182964211466279822828133246114741263620898853542511659005977098742505685248155022513107926722707345462354618444663133511693").unwrap(),
|
||||
Integer::from_str("5010303295979029720953954773805463848657367496896667256925387074631207128976445011411567186128665343367664557600927865746013809617850756247038364977849593298370638415538050617717579812040063809050466079467593876757904967054587247239775981173").unwrap(),
|
||||
Integer::from_str("3643715306191323974849750185026376664803002052031009917919146298629124228139669830885418351414368670190933608901908463160313491829979902265661425377942098542786579385118688686530379428281500432090209857512031899193610942009997666480141622931").unwrap(),
|
||||
Integer::from_str("4241834355731759088612098900889150480486830356437779625635656124158632786788891567665015370346587717023382467402755844902551269466840016945251052520143748217810459016980596787260934741544681783243577436529017346762263051435128563504848147047").unwrap(),
|
||||
Integer::from_str("2523900322512898153092283527555686191954886966926984043710614987380057039954266050243558368595618000310491183390298731322739555708825633335455707335046252155477145429505231996976303780687577721717937956727462248609588253109048826912219512233").unwrap(),
|
||||
Integer::from_str("1171824891807552748899024459763353345756465570610286429518292854539955442689370561445213645478177496112486904608544314008088766463602198222556565269084818799872887643847609538261074418353385510616209919715913997563223016102524218731609073989").unwrap(),
|
||||
Integer::from_str("46143420546617745197213974992864349706110841054938173439888506485894731816049443533063388738883948066474775508317079165731544093393852672679526902040341664165103617856112836137307481490757786503309809660177211850194917302104601047445901953").unwrap(),
|
||||
Integer::from_str("752940078968697502678967384415617976772053933529596207932495368245135279916303315035371282640886295210962243111798224672106391175631921911566406669776741217206089188001565916873143077167066022880702036063882903129906642676129495022972131209").unwrap(),
|
||||
Integer::from_str("1520329335648026567766367275046307578542257991128853001791455552493665632232325588405913221176897049790060536801309884790312144713538875231774340342847186215385917144874277668809985499482994078141272859278475075285977463657736734963652987373").unwrap(),
|
||||
Integer::from_str("50017625495288818782435924507013834110031999034643307338382821405698791610778877531830614693405608386655072058895222505909833754916862533905752631274852366748935792253442598350951461591550736346237955863906449458952663228800927140320157667").unwrap(),
|
||||
Integer::from_str("38401610206931167080264498597398870802860254093725730772991011582569894725813373580324866968569176388369611982707097825344506655231925447764442769351345178318652542550409150557352343943618674608946011463309394821673565650165744273097849949").unwrap(),
|
||||
Integer::from_str("184608244646942021323366304782439538668746375277959348413634650687235587234614717772753935753287722857766192563391263109670280253185426161046298354787439672044497169888140233752555779424149969713422475505388807903963252621863734032956280519").unwrap(),
|
||||
Integer::from_str("351257593287654452522276916291373563742090233637383104641821340906564637280571336214002417682603763101501053115051814027840290224795605063148356403544846161606884919930269677277921998672949839936317112237896436966630449023178621753921263019").unwrap(),
|
||||
Integer::from_str("17776213033029898042736097216007742758258673720676143715791913350512342764629944960235747926785035898455679245982654344139524841812891998487061291841045102881105147645119091822393445581339563032411679270141022474438218196237858872902098301").unwrap(),
|
||||
Integer::from_str("1119968749281206669187118962426182039471518541839452651714133200569385292395928211155932154512551823867768143506831179697150725335729082336884390018097450391780455129434304717766108240883676474188676687895688014005390129134060293445952714131").unwrap(),
|
||||
Integer::from_str("2380359028703143565637146811469828781458088476878403649995644924026273963767396041207843943179863650694243979825010501084343724584937371440937331372027478732522369607122724766608383356158192256503987385487068417019456480384653228271517184073").unwrap(),
|
||||
Integer::from_str("936391425922485612330507260988001138454208806035318063315033628148710609664547188763477146808759892616317103092432173093713978381604382096301822456981993396860893433866194478210978043268587964153688806562028136539787248761208718402921714823").unwrap(),
|
||||
Integer::from_str("2391922140661526942794958081614866503484666510987906109575239558478076826463675970540222364377429236018134610321177838404492145979186686367103845387306040811399772932134010203596245485657848849575365830819533003431899529331962049972105422829").unwrap(),
|
||||
Integer::from_str("964374520562152761892099701871246383149820707812540579294812519029773619714236033304961754196611532652288982150226191973613367922123899620952613834335606606286016170579235167587934724407287026718339208674781371124584567946455593866472142439").unwrap(),
|
||||
Integer::from_str("661248789387918195968343456268415015655227429901485551376733649662534559008900836450733880455467249525009566343824739697592753526891306540092946639656510220832776564628364080959055214446202095345118415029995831071367289505624996230686042743").unwrap(),
|
||||
Integer::from_str("1495554819407996415862156847203243369888937825574835272994697401723776375381219545680004526750874917248129621701075619516487125846492717688083196840105055779039883420765261872964729328338142922514236283019345885773272705802789375709371531891").unwrap(),
|
||||
Integer::from_str("2050623645029219438127819922659780851370739111321093329697282080391534071710675160727304612357988694773734599338417354100409517400415116108045288729878347023871908849359856487326222636295170968226843328973460491743192554642495605580203827647").unwrap(),
|
||||
Integer::from_str("5300307462410213577667480837938258777512352583051978520467068441893175668391866168747583454129771867041290645051627565118578602725370687799533406736037648231124221590788082333656018605599589489800640114935804161182962684573894987008279375881").unwrap(),
|
||||
Integer::from_str("3704327655413180273494896105414341120264540967426618385392149993686601012341448146813701061680592497964083943234912731844161335477856719778925685202496984827468326099066276955751929212099287128630393090960611662156345752418189491108549779761").unwrap(),
|
||||
Integer::from_str("4293873523905537531247339274016468845613818921758414861106911431522285730431627111776083755372250902094439575944006556178967448926801694819806680902651676479412361255593771594300163105918014188734865473316383051363586442734877422424944476487").unwrap(),
|
||||
Integer::from_str("1589457356017416267968030208391225107392251829332800185708809994594071680629191862623870630995580949827174233852065931316179886989972734453310743029959684374385051032958116409820646011612627461794497048612013500205304829106740521813279065839").unwrap(),
|
||||
Integer::from_str("677060499756811014115027316973737658993937681267671378751091515074444191639222306675859985253758266662687011882335084637681850124628916282787941181661248429412152192230660554583653075199720096784977912362093898785710927643429800554309996621").unwrap(),
|
||||
Integer::from_str("4556683258594822402855414380362620295231673046713752880933967889771646856051745784462468117575177892006513392693685616569935833357648393898915677206732580748330214938398411668157941515847730087263301030154072458063812554524260405671629754999").unwrap(),
|
||||
Integer::from_str("1602074580348123931489241137005511885150980182400049992026659585131187985620536794154659820191316264063547338262596211651955802983450000900446591221580949545163434870046188079786417621515405352023176920247457687361358148356208096808525338397").unwrap(),
|
||||
Integer::from_str("2561993755606565068035375148802286812072711717323441363005149722023895797027723216764951149251447180880317275019544062589806987036712157902709291674934493635207098007981128987753281766285445399631018190456476459604899786219806829862034503919").unwrap(),
|
||||
Integer::from_str("1457054801380350736800076081677201400665406203824020727471775641174383980331187058211832905604880205627938232136048301389594977658775329490376467311636742994730009572046684919498881836580821362806591224089188354188782107744327550013385898679").unwrap(),
|
||||
Integer::from_str("63236406531205434317594389945524553066650347945711034187542626293222184231786980314347573971609802315464270916666042219689326463061892323637662557342398379414478296594450374661462435994098294952191568682470529143295022566680404002417824407").unwrap(),
|
||||
Integer::from_str("197584207289801721640320350702781512605131263686515431131918340568997783498811538104924263177220361290500812540231048642224996620094592927292942263102162109623392197130698355962984228640696217934383302653006588137949636000986800801778335657").unwrap(),
|
||||
Integer::from_str("107646974355805618130192750841008263946998235997036512644246089806483971253986128403392278299190598483359268422291624377225409658571257936659998943160556099228016404911568061972541462863973742808216138653302666989981023076627131009019648093").unwrap(),
|
||||
Integer::from_str("1339338638103691041488101095975795624888087363910833767941545495164307897693922886889431835980515628174298063795556722365483994582432076986194090322659335982083818451837412988740007497627907154682332316972997765904572884621671832534078952307").unwrap(),
|
||||
Integer::from_str("4434008847683596023521080910694307462609680232648893208331172489192536036999251664058651161016448705529504803145115341661351913895515662510503514243928030586139092055076376059786525834604160882940981043706619590945099008097035756330871176929").unwrap(),
|
||||
Integer::from_str("2861034394438211841574954026003099819138101239247590122220350015475642835378420417008259980687528330087930738069620032709655292858712710050922359392413494086067180601383341612168193292772028605966992134213209023470256124404157207490432001519").unwrap(),
|
||||
Integer::from_str("2192496740130688243467014868961425982524426805724142867736885035473886629020046845749143690992453345556925544037271383038390660805714030629830845497904446979103911346917405936472233104694103049940390437540539269358666128436739707024829933171").unwrap(),
|
||||
Integer::from_str("4729254672091433598483706976591610165407510022326154887172965802144851945337220063633854456109688411742113721031379206359782182729020553179365019549633309936476652959201812418790254033614677768930428905990768941807243900642422321011756634063").unwrap(),
|
||||
];
|
||||
|
||||
static ref E: Integer = Integer::from(65537);
|
||||
static ref E_100: Integer = Integer::from(65537).pow(100);
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
n = 1000000000001145001
|
||||
x = 935504152258349142153756545027828333134502429815898853337434111035772753274298247562421282857225670294658871951566740526892519325930337394689734885958045678674585250121996049281620596578037697388040730892475705736002027099964789174115489575
|
||||
|
||||
|
||||
n = 1000000000072575001
|
||||
x = 546106984416375692279579316993165581647744624953870698906430198525494209177887357935777586504349202038571291730277816358008624296244276841351481284323881231286987401276869989221861844649820074846780554419816669235773068026326964231557588363
|
||||
|
||||
*/
|
||||
|
||||
fn main() {
|
||||
let truth = Integer::from(42);
|
||||
let w: usize = X.clone().modulo(&truth).try_into().unwrap();
|
||||
println!("w = {w}");
|
||||
|
||||
compute_async(move |tx| {
|
||||
let mut n = N;
|
||||
let y = X.clone().div_floor(&truth);
|
||||
|
||||
let mut temp = y.clone();
|
||||
loop {
|
||||
for _ in 0..10_000 {
|
||||
n += 1;
|
||||
temp = temp.pow_mod(&E_100, &M[w]).unwrap();
|
||||
}
|
||||
|
||||
let mut res = temp.clone();
|
||||
res *= &truth;
|
||||
res += w;
|
||||
tx.send((n, res)).unwrap();
|
||||
}
|
||||
});
|
||||
}
|
@@ -11,22 +11,37 @@ pub mod challenges;
|
||||
|
||||
const USER_NAME: &str = "Jonah";
|
||||
|
||||
pub fn compute_async<T1: Display + Send + 'static, T2: Display + Send + 'static, R: Send + 'static>(function: impl FnMut(Sender<(T1, T2)>) -> R + Send + 'static ) -> R {
|
||||
pub fn compute_async<
|
||||
T1: Display + Send + 'static,
|
||||
T2: Display + Send + 'static,
|
||||
R: Send + 'static
|
||||
>(
|
||||
function: impl FnMut(Sender<(T1, T2)>) -> R + Send + 'static
|
||||
) -> R {
|
||||
compute_async_with_name(USER_NAME, function)
|
||||
}
|
||||
|
||||
|
||||
pub fn compute_async_with_name<T1: Display + Send + 'static, T2: Display + Send + 'static, R: Send + 'static>(name: &'static str, mut function: impl FnMut(Sender<(T1, T2)>) -> R + Send + 'static ) -> R {
|
||||
let (tx, jh1) = spawn_submission_thread(name);
|
||||
let jh2 = thread::spawn(move || {
|
||||
function(tx)
|
||||
});
|
||||
|
||||
jh1.join().unwrap();
|
||||
jh2.join().unwrap()
|
||||
pub fn compute_async_with_name<
|
||||
T1: Display + Send + 'static,
|
||||
T2: Display + Send + 'static,
|
||||
R: Send + 'static
|
||||
>(
|
||||
name: &'static str,
|
||||
mut function: impl FnMut(Sender<(T1, T2)>) -> R + Send + 'static
|
||||
) -> R {
|
||||
let (tx, jh) = spawn_submission_thread(name);
|
||||
let result = function(tx);
|
||||
jh.join().unwrap();
|
||||
result
|
||||
}
|
||||
|
||||
pub fn spawn_submission_thread<T1: Display + Send + 'static, T2: Display + Send + 'static>(name: &'static str) -> (Sender<(T1, T2)>, JoinHandle<()>) {
|
||||
pub fn spawn_submission_thread<
|
||||
T1: Display + Send + 'static,
|
||||
T2: Display + Send + 'static
|
||||
>(
|
||||
name: &'static str
|
||||
) -> (Sender<(T1, T2)>, JoinHandle<()>) {
|
||||
let (tx, rx) = mpsc::channel::<(T1, T2)>();
|
||||
let handle = thread::spawn(move || {
|
||||
let mut t = Instant::now();
|
||||
@@ -44,11 +59,21 @@ pub fn spawn_submission_thread<T1: Display + Send + 'static, T2: Display + Send
|
||||
(tx, handle)
|
||||
}
|
||||
|
||||
pub fn submit<T1: Display + Send, T2: Display + Send>(n: T1, x: T2) -> Result<Option<String>> {
|
||||
pub fn submit<
|
||||
T1: Display + Send,
|
||||
T2: Display + Send
|
||||
>(
|
||||
n: T1, x: T2
|
||||
) -> Result<Option<String>> {
|
||||
submit_with_name(USER_NAME, n, x)
|
||||
}
|
||||
|
||||
pub fn submit_with_name<T1: Display + Send, T2: Display + Send>(name: &str, n: T1, x: T2) -> Result<Option<String>> {
|
||||
pub fn submit_with_name<
|
||||
T1: Display + Send,
|
||||
T2: Display + Send
|
||||
>(
|
||||
name: &str, n: T1, x: T2
|
||||
) -> Result<Option<String>> {
|
||||
let name = percent_encoding::percent_encode(name.as_bytes(), percent_encoding::NON_ALPHANUMERIC);
|
||||
let url = format!("https://button.qedaka.de/server.php?name={}&n={n}&x={x}", name);
|
||||
let body = reqwest::blocking::get(url)?.text()?;
|
||||
|
Reference in New Issue
Block a user