Odd and square numbers: Difference between revisions

(add OCaml)
Line 415:
 
=={{header|Julia}}==
<syntaxhighlight lang="julia">oddsquares(lim) = [i^2 for i ∈ Int.(range((√).(lim)...)) if isodd(i)]
{{trans|FreeBASIC}}
oddsquares((100, 999))
<syntaxhighlight lang="julia">julia> i = n = 1
1
 
julia> while n < 1000
n > 100 && println(n)
n += 8i
i += 1
end
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>
39

edits