From c582670d23f45a58cf9b87384fd52f47041f5227 Mon Sep 17 00:00:00 2001 From: fredrikr79 Date: Sat, 4 Oct 2025 08:26:46 +0200 Subject: [PATCH] solve 44 in uiua (fast) --- 44/main.ua | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/44/main.ua b/44/main.ua index 40df448..b34abec 100644 --- a/44/main.ua +++ b/44/main.ua @@ -1,10 +1,8 @@ -# Experimental! -# project euler 44 -p ← ÷2×⊸(-1×3) -c ← =0-⊸⌊°p -# ⧈₂/(↧∩c⊃+-) p +1⇡100 -# ⍢+₁/(¬↥∩c⊃+-∩p) 1_2 -# &p⟜/-p -⌊▽⊸(c∂p) +1.5⇡100000000 -≡(p⊂⟜+₁) -▽⊸(c≡/+) +# pentagonal(n) ? n +P ← ÷2×⊸(-1×3) +# is_pentagonal(n) ? n +IsP ← =⟜⌊°P + +⧅<2 P+1⇡3000 # pentagonal number pairs +▽⊸(/(↧∩IsP⊃+-)⍉) # sum and diff are pent +/-⊢ # get first such (which is minimal)