make it faster yet

This commit is contained in:
2025-09-11 15:37:37 +02:00
parent 013f22d9c7
commit 02f3bfffce
3 changed files with 364 additions and 1334 deletions

View File

@@ -0,0 +1,256 @@
6563504930575804778
3177554099846544556
14859870375767071104
2361978668621667923
3143167595286206242
14095566306004759633
6896557042998150768
4462024892233517220
6694476164706603992
4101034334834323206
16919437506981809216
7555882741782405923
2628576702768829495
9893623336811473734
321448934705618219
10658829649099122152
2041445642416509779
10219048753829035159
16805862748866069158
10040916278977753989
6307216144763488332
7556799640693587259
10364880594488944589
4148363280372604554
10843489283249915473
10941839320982089921
12200589183353651648
13289846021634563271
9908808602666874083
11200096838332863267
8779557412750126267
8653500638442577520
5278382863123262139
5783872159081604742
8125287062915914468
2242536959895356377
4005886220233485538
16562333581271451717
1417622956358486028
17949254327843118224
11638382071724344512
1599533962231322857
3108365940793816305
4242306746708662266
4952142584625629079
8415262979453050616
17056549971761457216
3044401595350323209
9932836459025874446
17683019803052515221
2433910229198456491
11984404922749323692
5524563739374899072
18259777400123222730
4011842113907150331
13821416711910403019
6047075845099054027
15787995709438817819
15586362769001272194
9547178878896838664
7095984364360639673
11886247752272930995
9985144182130335662
13251170938278484486
4652450378788876572
1718813027742122072
663918887826880444
6670740316248663863
6700009143044041388
16923466181555045374
11387212886131952048
13965979168082782709
2422236213071595233
4699138634002865087
6493539149331166441
7518901355855126514
16145558963603531461
14786024152105552650
6994957500730603671
6969343254888557997
13840983121869895238
13660562997364925760
17265722274403090344
16718136092983418592
4687774949942350684
1375392036798645113
2003687933393780368
10165815540082234487
6089981897628107340
14541747794483572236
10203690416684845063
3215632556062991790
5425642782789424861
13599224699425799085
12514386124935070361
8663785549291965158
16808180269220250739
958315213891692337
17602667895639479950
1575696692466204467
17915906007703271560
14748722093156428888
1657002993440401555
661824732220019475
4209888120689731341
16768316015744524190
4243337273520801682
2339349826505601295
3824297886017649294
12702982826142705690
16612576840497393302
14651413872459783243
1731111914295200492
7107419468395208292
13131631592659790069
7650600002594848965
10405567400049055611
8308615406494459745
3539740125465153737
5461340322324117263
3781913427618838536
15971526239448286573
14866630059533000065
9057464874518875466
12416130366361631938
16536231451954324990
16940792417174466635
5850876492391527467
8409677954752892479
14645542356465944448
222773118531975189
8843321651534853339
18155004654525928367
874144551332925702
13029240668713846903
10134094171892588961
14847849150997407724
15268365766299545880
12681437973300849606
9073037709094073235
5903235897841107084
13454671887999382224
1858835333224639960
9249476666791031049
4223733763389771996
15384221398063151306
10517318028043688548
14460943107538037335
5154513940699923775
1487808311209105759
10531814582629388228
13949079608223777930
7235144852537941787
15896454296269928651
17639234901395308799
3843116287193798732
13850621202730186058
14394021663790134434
5156903507008819810
8215065870912194262
4311375377346268620
10171989316456362870
163589086269419441
3851905914730271938
15334437853140690383
15539559255153964902
16896869453263295473
5093215075951161381
11973288268634380358
5063471141738823749
14989360565903092894
14383904172638615636
16726778109629071291
8426599513938923802
10135704539862093112
10650096844272335586
11665119603940578625
16874279119083921534
5506586508252141218
12933308300960365793
5248411009075909495
2258335812944206660
8597559794487195679
7377768646895780754
3492695033858227458
10967074645264403701
4191289746488745512
10814396656746439511
7977751296373368968
7365044695914860944
719961330644640786
9787541545720428689
15604445254264824171
2390604585013608559
11986374754145330532
11017949026101828516
12566345980261789685
15356854551478336603
7512099414187555837
12750275831668325946
10214055675311439170
13443646811679848535
16700058242611721938
4423454089307812290
9103802734880117173
2844597800879830746
13843180097957768889
8451963189055726564
3487238693652813426
1299546876649551534
12113986972185246713
6519448239293388674
15121003074094999781
14734970561277902445
14188671603580717908
6990763574012814336
10826116378520780499
12743257710490956107
10544515943049329704
7398185314804331323
17207979707505274370
10312488623848443780
2525681217825377635
1209032913852334193
2466271244689038797
11480020761807728949
9382271556984549762
11547951404763329175
6098523488344631739
13976835011142976617
5952967173673330791
10742137247908568911
17711990646608869291
614357866529740908
9459271394207301277
13255507779934222511
4405075157125241953
2658215311620786269
3438348388076752545
11273337813277990213
6461206275074180061
407462859018947407
16015082222849827426
15274784353409233905
10868734442868526034
15301879674491522395
15304647555608021557
1004732939015301729
14098615156664030434
11650248670150490593
15906967279319496936
531379790791487398
11796026101712826135
2668163399826034890
1114227485540495868
12046048025420064663

View File

@@ -0,0 +1,42 @@
F = GF(2)
R.<x> = PolynomialRing(F)
S.<xi> = R.quotient_ring(x^64 + 1)
T.<X> = PolynomialRing(S)
Ti.<Xi> = T.quotient_ring(X^64 + 1)
Tj.<Xj> = T.quotient_ring(X^64)
def num_to_poly(num):
out = 0
i = 0
while num != 0:
if num % 2 == 1:
out += xi^i
i += 1
num //= 2
return out
def poly_to_num(poly):
out = 0
for i in range(0, 64):
if poly[i] == 1:
out |= 1 << i
return out
with open("./07_weird_assembly_machine.data") as f:
data = [int(line) for line in f.readlines() if line]
f = reduce(lambda a, b: a * X + b, [num_to_poly(a) for a in data[:128]])
g = reduce(lambda a, b: a * X + b, [num_to_poly(a) for a in data[128:]])
fg = f(g)
fgi = Ti([fg[i] for i in range(0, fg.degree())])
fgj = Tj([fg[j] for i in range(0, fg.degree())])
print("\n\n======= f(g(x)) =======")
for i in reversed(range(0, 64)):
print(poly_to_num(fgi.lift()[i]))
print("\n\n======= f(g(x)) =======")
for i in reversed(range(0, 64)):
print(poly_to_num(fgj.lift()[i]))