Undulating numbers: Difference between revisions

m
(added Uiua solution)
 
Line 1,600:
# Generate all distinct two digit numbers as strings.
≡(°⋕)▽≡(≠0◿11).↘10⇡100
&p≡(⋕⊂⟜⊢) . &pf "Three digits: "
&p≡(⋕⊂.) . &pf "Four digits: "
&p≡(⋕⊂⟜⊢)
≡(⋕⊂⟜⊢) . &pf "FourThree digit digitsprimes: "
&p≡(⋕⊂.)
. &pf "Three digit primes: "
≡(⋕⊂⟜⊢)
# Primes by sieve.
⇌◌⍢(▽≠0◿⊃⊢(.↘1)⟜(⊂⊢)|>0⧻)↘2⇡1000[]
&p▽:⟜(/+⍉⊞⌕):
 
# Collect all 3 and 4 digit numbers.
⊂⊃≡(⋕⊂⟜⊢)≡(⋕⊂.)
 
# Double-up last two digits of each and remove the ensuing duplicates.
F ← ◴⊂⟜≡(⋕⊂⟜(↙¯2)°⋕)
 
# Repeat until length is okay.
⍢(F|<600⧻)
&p⊡599 . &pf "Six hundredth: "
&p⊡599
# Repeat until last is larger than target.
⍢(F|<ⁿ53 2⊡¯1)
&p⧻.▽<ⁿ53 2. &pf "Count less than 2^53: "
&p⊡¯1⊏⍏. &pf "Last one less than 2^53: "
&p⧻.▽<ⁿ53 2.
 
&pf "Last one less than 2^53: "
&p⊡¯1⊏⍏.
</syntaxhighlight>
{{out}}
Line 1,636 ⟶ 1,628:
Last one less than 2^53: 8989898989898989
</pre>
 
 
 
=={{header|Wren}}==
155

edits