Skip to content

Instantly share code, notes, and snippets.

@brv00
Created October 29, 2020 13:12
Show Gist options
  • Save brv00/fe15505eba8739bf454fc2b5e0a390f3 to your computer and use it in GitHub Desktop.
Save brv00/fe15505eba8739bf454fc2b5e0a390f3 to your computer and use it in GitHub Desktop.
Untitled7.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "xs = collect(1:9)\ncount = 0\nfor i in 1:9\n for j in i + 1:9\n xs[i], xs[j] = xs[j], xs[i]\n _12345 = 0\n for i = 1:5\n _12345 = 10 * _12345 + xs[i]\n end\n if _12345 % xs[2] == xs[1]\n count += 1\n println(count < 10 ? \" \" : \"\", count, \": \", _12345, \" % \", xs[2], \" = \", xs[1], \" ($i↔$j)\")\n end\n xs[i], xs[j] = xs[j], xs[i]\n end\nend",
"execution_count": 6,
"outputs": [
{
"output_type": "stream",
"text": " 1: 14325 % 4 = 1 (2↔4)\n 2: 16345 % 6 = 1 (2↔6)\n 3: 18345 % 8 = 1 (2↔8)\n 4: 12435 % 2 = 1 (3↔4)\n 5: 12543 % 2 = 1 (3↔5)\n 6: 12645 % 2 = 1 (3↔6)\n 7: 12745 % 2 = 1 (3↔7)\n 8: 12845 % 2 = 1 (3↔8)\n 9: 12945 % 2 = 1 (3↔9)\n10: 12365 % 2 = 1 (4↔6)\n11: 12375 % 2 = 1 (4↔7)\n12: 12385 % 2 = 1 (4↔8)\n13: 12395 % 2 = 1 (4↔9)\n14: 12347 % 2 = 1 (5↔7)\n15: 12349 % 2 = 1 (5↔9)\n16: 12345 % 2 = 1 (6↔7)\n17: 12345 % 2 = 1 (6↔8)\n18: 12345 % 2 = 1 (6↔9)\n19: 12345 % 2 = 1 (7↔8)\n20: 12345 % 2 = 1 (7↔9)\n21: 12345 % 2 = 1 (8↔9)\n",
"name": "stdout"
}
]
}
],
"metadata": {
"kernelspec": {
"name": "julia-1.4",
"display_name": "Julia 1.4.2",
"language": "julia"
},
"language_info": {
"file_extension": ".jl",
"name": "julia",
"mimetype": "application/julia",
"version": "1.4.2"
},
"gist": {
"id": "",
"data": {
"description": "Untitled7.ipynb",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment