solve 26 in uiua (FAST)
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
|||||||
|
# project euler 26
|
||||||
|
|
||||||
|
# divide a by b, doing one iteration of long division.
|
||||||
|
# ? b a
|
||||||
|
Div ← ×10-⊸(×⌊⤚÷)
|
||||||
|
|
||||||
|
# we will have to perform long division at most 1000
|
||||||
|
# times, so just do it 1000 times for all numbers
|
||||||
|
# below 1000, pervasively.
|
||||||
|
# use the steps to determine cycle lengths.
|
||||||
|
|
||||||
|
1000
|
||||||
|
⍥⟜⊸Div⟜⊃⇡(↯⊙1) # pervasively repeat long division.
|
||||||
|
⊢⊚=⊸/↥≡(⧻◴)⍉ # cycle length is dedup length.
|
||||||
Reference in New Issue
Block a user