Undulating numbers: Difference between revisions
m
→{{header|Uiua}}
(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: "
≡(⋕⊂⟜⊢) . &pf "
# 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: "
# 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: "▼
▲&pf "Last one less than 2^53: "
</syntaxhighlight>
{{out}}
Line 1,636 ⟶ 1,628:
Last one less than 2^53: 8989898989898989
</pre>
=={{header|Wren}}==
|