Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Removal of Multiples drill from Programming Praxis
- function main(s::Array{Int64, 1}, N::Int64)
- ind = trues(N)
- for x in s # iterate over all elements of s
- if ind[x] # x isn't a multiple of the previous elements of s
- for i = x:x:N
- ind[i] = false
- end
- end
- end
- return (1:N)[ind]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement