RosettaCodeData/Task/Additive-primes/Uiua/additive-primes.uiua
2024-04-19 16:56:29 -07:00

15 lines
434 B
Text

[] # list of primes to be populated
↘2⇡500 # candidates (starting at 2)
# Take the first remaining candidate, which will be prime, save it,
# then remove every candidate that it divides. Repeat until none left.
⍢(▽≠0◿⊃⊢(.↘1)⟜(⊂⊢)|>0⧻)
# Tidy up.
⇌◌
# Build sum of digits of each.
≡(/+≡⋕°⋕)...
# Mask out those that result in non-primes.
⊏⊚±⬚0⊏⊗
# Return values and length.
⧻.