Last active
December 8, 2022 22:18
-
-
Save niczky12/b8307d49fe9d81907cabc83b7fa77744 to your computer and use it in GitHub Desktop.
Silly Julia function for detecting multiples of 12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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