Odd and square numbers: Difference between revisions
→{{header|Julia}}
(add OCaml) |
|||
Line 415:
=={{header|Julia}}==
<syntaxhighlight lang="julia">oddsquares(lim) = [i^2 for i ∈ Int.(range((√).(lim)...)) if isodd(i)]
oddsquares((100, 999))
121▼
169▼
225▼
289▼
361▼
441▼
529▼
625▼
729▼
841▼
961▼
</syntaxhighlight>
{{Out}}
<pre>
11-element Vector{Int64}:
▲ 121
▲ 169
▲ 225
▲ 289
▲ 361
▲ 441
▲ 529
▲ 625
▲ 729
▲ 841
▲ 961
</pre>
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<syntaxhighlight lang="mathematica">Cases[Range[100, 1000], _?(IntegerQ[Sqrt@#] && OddQ[#] &)]</syntaxhighlight>
|