Skip to content

Instantly share code, notes, and snippets.

@antimon2
Last active May 25, 2023 14:22
Show Gist options
  • Save antimon2/cd02c270d73264ff045162b5949b3cf5 to your computer and use it in GitHub Desktop.
Save antimon2/cd02c270d73264ff045162b5949b3cf5 to your computer and use it in GitHub Desktop.
13446204MMdd/13446204Mmdd_is_not_prime.jl.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"ExecuteTime": {
"start_time": "2023-05-25T14:17:18.174Z",
"end_time": "2023-05-25T23:17:19.276000+09:00"
},
"trusted": true
},
"cell_type": "code",
"source": "versioninfo()",
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": "Julia Version 1.9.0\nCommit 8e630552924 (2023-05-07 11:25 UTC)\nPlatform Info:\n OS: Linux (x86_64-linux-gnu)\n CPU: 12 × Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz\n WORD_SIZE: 64\n LIBM: libopenlibm\n LLVM: libLLVM-14.0.6 (ORCJIT, skylake)\n Threads: 2 on 12 virtual cores\n",
"name": "stdout"
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2023-05-25T14:17:25.024Z",
"end_time": "2023-05-25T23:17:29.537000+09:00"
},
"trusted": true
},
"cell_type": "code",
"source": "]instantiate",
"execution_count": 2,
"outputs": []
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2023-05-25T14:17:34.124Z",
"end_time": "2023-05-25T23:17:33.839000+09:00"
},
"trusted": true
},
"cell_type": "code",
"source": "using Dates, Primes",
"execution_count": 3,
"outputs": []
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2023-05-25T14:18:42.429Z",
"end_time": "2023-05-25T23:18:42.610000+09:00"
},
"trusted": true
},
"cell_type": "code",
"source": "dt2num(dt) = (year(dt) * 100 + month(dt)) * 100 + day(dt)",
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 4,
"data": {
"text/plain": "dt2num (generic function with 1 method)"
},
"metadata": {}
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2023-05-25T14:18:51.344Z",
"end_time": "2023-05-25T23:18:51.257000+09:00"
},
"trusted": true
},
"cell_type": "code",
"source": "dt2num(today())",
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 5,
"data": {
"text/plain": "20230525"
},
"metadata": {}
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2023-05-25T14:20:00.816Z",
"end_time": "2023-05-25T23:20:01.785000+09:00"
},
"trusted": true
},
"cell_type": "code",
"source": "dtnums_13446204 = dt2num.(Date(13446204, 1, 1):Day(1):Date(13446204, 12, 31))",
"execution_count": 6,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 6,
"data": {
"text/plain": "366-element Vector{Int64}:\n 134462040101\n 134462040102\n 134462040103\n 134462040104\n 134462040105\n 134462040106\n 134462040107\n 134462040108\n 134462040109\n 134462040110\n 134462040111\n 134462040112\n 134462040113\n ⋮\n 134462041220\n 134462041221\n 134462041222\n 134462041223\n 134462041224\n 134462041225\n 134462041226\n 134462041227\n 134462041228\n 134462041229\n 134462041230\n 134462041231"
},
"metadata": {}
}
]
},
{
"metadata": {
"ExecuteTime": {
"start_time": "2023-05-25T14:20:17.946Z",
"end_time": "2023-05-25T23:20:17.975000+09:00"
},
"trusted": true
},
"cell_type": "code",
"source": "all(!isprime, dtnums_13446204)",
"execution_count": 7,
"outputs": [
{
"output_type": "execute_result",
"execution_count": 7,
"data": {
"text/plain": "true"
},
"metadata": {}
}
]
}
],
"metadata": {
"kernelspec": {
"name": "julia-1.9",
"display_name": "Julia 1.9.0",
"language": "julia"
},
"language_info": {
"file_extension": ".jl",
"name": "julia",
"mimetype": "application/julia",
"version": "1.9.0"
},
"gist": {
"id": "",
"data": {
"description": "13446204MMdd/13446204Mmdd_is_not_prime.jl.ipynb",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae"
[compat]
julia = "1.6"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment