Skip to content

Instantly share code, notes, and snippets.

@niczky12
Last active December 8, 2022 22:18
Show Gist options
  • Save niczky12/b8307d49fe9d81907cabc83b7fa77744 to your computer and use it in GitHub Desktop.
Save niczky12/b8307d49fe9d81907cabc83b7fa77744 to your computer and use it in GitHub Desktop.
Silly Julia function for detecting multiples of 12
using Test
ismultiple(n, d) = n % d == 0
ismultiple12(n) = ismultiple(n, 12)
@test ismultiple12(12)
@test ismultiple12(36)
@test !ismultiple12(37)
@test isapprox(sum(ismultiple12.(1:10000)), 10000/12; atol=0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment