15 lines
419 B
Plaintext
15 lines
419 B
Plaintext
# 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.
|