Square-free integers: Difference between revisions

Content added Content deleted
m (→‎{{header|Wren}}: Minor tidy)
(Added Uiua solution)
 
Line 3,223: Line 3,223:
Counting 60794 square-free integers in range 1..100000
Counting 60794 square-free integers in range 1..100000
Counting 607926 square-free integers in range 1..1000000</pre>
Counting 607926 square-free integers in range 1..1000000</pre>

=={{header|Uiua}}==
Formatting the output is left as an exercise for the reader.
<syntaxhighlight lang="uiua">
Sqf ← ≠0/↧◿⊸(×.↘2⇡+1⌊√)
⟜⧻▽⊸≡Sqf +1⇡145
⟜⧻▽⊸≡Sqf +1e12+1⇡145
N ← 1000000
# Find all squares and their multiples, and exclude them from range
▽:⟜(¬∊)⇡⟜(⊏⊸⍏◴/◇⊂≡(□×⇡+1⌊÷:⊙.,)×.↘2⇡√.)N
# Test which are below limit and count them.
⊙◌≡(/+<)⇌[⍥(×10.)4 100]¤
</syntaxhighlight>
{{out}}
<pre>
90
[1 2 3 5 6 7 10 11 13 14 15 17 19 21 22 23 26 29 30 31 33 34 35 37 38 39 41 42 43 46 47 51 53 55 57 58 59 61 62 65 66 67 69 70 71 73 74 77 78 79 82 83 85 86 87 89 91 93 94 95 97 101 102 103 105 106 107 109 110 111 113 114 115 118 119 122 123 127 129 130 131 133 134 137 138 139 141 142 143 145]
89
[1000000000001 1000000000002 1000000000003 1000000000005 1000000000006 1000000000007 1000000000009 ...etc... 1000000000142 1000000000145]
[61 608 6083 60794 607926]
</pre>


=={{header|Visual Basic .NET}}==
=={{header|Visual Basic .NET}}==