<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/coloring-sudokus/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://fronkonstin.com/2018/06/01/coloring-sudokus/"> R – Fronkonstin</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div class="twitter-share"><a rel="nofollow" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Ffronkonstin.com%2F2018%2F06%2F01%2Fcoloring-sudokus%2F&via=aschinchon" class="twitter-share-button" target="_blank">Tweet</a></div>
<blockquote>
<p>Someday you will find me<br>
caught beneath the landslide<br>
(Champagne Supernova, Oasis)</p>
</blockquote>
<p>I recently read a book called <em>Snowflake Seashell Star: Colouring Adventures in Numberland</em> by Alex Bellos and Edmund Harris which is full of mathematical patterns to be coloured. All images are truly appealing and cause attraction to anyone who look at them, independently of their age, gender, education or political orientation. This book demonstrates how maths are an astonishing way to reach beauty.</p>
<p>One of my favourite patterns are tridokus, a sophisticated colored version of sudokus. Coloring a sudoku is simple: once that is solved it is enough to assign a color to each number (from 1 to 9).  If you superimpose three colored sudokus with no cells at the same position sharing the same color, and using again nine colors, the resulting image is a tridoku:</p>
<p><img data-orig-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/1930_20180523221339.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/1930_20180523221339.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4525" data-image-meta="{" data-image-description="" src="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/1930_20180523221339.png?resize=604%2C604&ssl=1" data-permalink="https://fronkonstin.com/2018/06/01/coloring-sudokus/1930_20180523221339/" data-large-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/1930_20180523221339.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="1930_20180523221339" sizes="(max-width: 604px) 100vw, 604px" width="450" data-comments-opened="1" class="wp-image-4525" data-recalc-dims="1"></p>
<p>There is something attractive in a tridoku due to the balance of colors but also they seem a quite messy: they are a <em>charmingly unbalanced</em>.  I wrote a script to generalize the concept to <em>n-dokus</em>. The idea is the same: superimpose n sudokus without cells sharing color and position (I call them <em>disjoint</em> sudokus) using just nine different colors. I did’n’t prove it, but I think the maximum amount of sudokus can be overimposed with these constrains is 9. This is a complete series from 1-doku to 9-doku (click on any image to enlarge):</p>
<p><a rel="nofollow" href="https://fronkonstin.com/292482_1_20180530224205/" target="_blank"><img data-orig-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_1_20180530224205.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_1_20180530224205.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4527" data-image-meta="{" src="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_1_20180530224205.png?resize=150%2C150&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/292482_1_20180530224205/" data-large-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_1_20180530224205.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="292482_1_20180530224205" sizes="(max-width: 150px) 100vw, 150px" width="150" data-comments-opened="1" height="150"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/292482_2_20180530224227/" target="_blank"><img data-orig-file="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_2_20180530224227.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_2_20180530224227.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4528" data-image-meta="{" src="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_2_20180530224227.png?resize=150%2C150&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/292482_2_20180530224227/" data-large-file="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_2_20180530224227.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="292482_2_20180530224227" sizes="(max-width: 150px) 100vw, 150px" width="150" data-comments-opened="1" height="150"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/292482_3_20180530224245/" target="_blank"><img data-orig-file="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_3_20180530224245.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_3_20180530224245.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4529" data-image-meta="{" src="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_3_20180530224245.png?resize=150%2C150&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/292482_3_20180530224245/" data-large-file="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_3_20180530224245.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="292482_3_20180530224245" sizes="(max-width: 150px) 100vw, 150px" width="150" data-comments-opened="1" height="150"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/292482_4_20180530224323/" target="_blank"><img data-orig-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_4_20180530224323.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_4_20180530224323.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4530" data-image-meta="{" src="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_4_20180530224323.png?resize=150%2C150&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/292482_4_20180530224323/" data-large-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_4_20180530224323.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="292482_4_20180530224323" sizes="(max-width: 150px) 100vw, 150px" width="150" data-comments-opened="1" height="150"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/292482_5_20180530224338/" target="_blank"><img data-orig-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_5_20180530224338.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_5_20180530224338.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4531" data-image-meta="{" src="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_5_20180530224338.png?resize=150%2C150&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/292482_5_20180530224338/" data-large-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_5_20180530224338.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="292482_5_20180530224338" sizes="(max-width: 150px) 100vw, 150px" width="150" data-comments-opened="1" height="150"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/292482_6_20180530224352/" target="_blank"><img data-orig-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_6_20180530224352.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_6_20180530224352.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4532" data-image-meta="{" src="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_6_20180530224352.png?resize=150%2C150&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/292482_6_20180530224352/" data-large-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_6_20180530224352.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="292482_6_20180530224352" sizes="(max-width: 150px) 100vw, 150px" width="150" data-comments-opened="1" height="150"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/292482_7_20180530224413/" target="_blank"><img data-orig-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_7_20180530224413.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_7_20180530224413.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4533" data-image-meta="{" src="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_7_20180530224413.png?resize=150%2C150&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/292482_7_20180530224413/" data-large-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_7_20180530224413.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="292482_7_20180530224413" sizes="(max-width: 150px) 100vw, 150px" width="150" data-comments-opened="1" height="150"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/292482_8_20180530224450/" target="_blank"><img data-orig-file="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_8_20180530224450.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_8_20180530224450.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4534" data-image-meta="{" src="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_8_20180530224450.png?resize=150%2C150&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/292482_8_20180530224450/" data-large-file="https://i1.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_8_20180530224450.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="292482_8_20180530224450" sizes="(max-width: 150px) 100vw, 150px" width="150" data-comments-opened="1" height="150"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/292482_9_20180530224521/" target="_blank"><img data-orig-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_9_20180530224521.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_9_20180530224521.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4535" data-image-meta="{" src="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_9_20180530224521.png?resize=150%2C150&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/292482_9_20180530224521/" data-large-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/292482_9_20180530224521.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="292482_9_20180530224521" sizes="(max-width: 150px) 100vw, 150px" width="150" data-comments-opened="1" height="150"></a></p>
<p>I am a big fan of <code>colourlovers</code> package. These tridokus are colored with some of my favourite palettes from there:</p>
<p><a rel="nofollow" href="https://fronkonstin.com/937624_20180523221302/" target="_blank"><img data-orig-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/937624_20180523221302.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/937624_20180523221302.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4542" data-image-meta="{" src="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/937624_20180523221302.png?fit=300%2C300&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/937624_20180523221302/" data-large-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/937624_20180523221302.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="937624_20180523221302" sizes="(max-width: 300px) 100vw, 300px" width="300" data-comments-opened="1" height="300"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/482774_20180523221301/" target="_blank"><img data-orig-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/482774_20180523221301.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/482774_20180523221301.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4541" data-image-meta="{" src="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/482774_20180523221301.png?fit=300%2C300&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/482774_20180523221301/" data-large-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/482774_20180523221301.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="482774_20180523221301" sizes="(max-width: 300px) 100vw, 300px" width="300" data-comments-opened="1" height="300"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/443995_20180523221334/" target="_blank"><img data-orig-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/443995_20180523221334.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/443995_20180523221334.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4540" data-image-meta="{" src="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/443995_20180523221334.png?fit=300%2C300&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/443995_20180523221334/" data-large-file="https://i0.wp.com/fronkonstin.com/wp-content/uploads/2018/05/443995_20180523221334.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="443995_20180523221334" sizes="(max-width: 300px) 100vw, 300px" width="300" data-comments-opened="1" height="300"></a><br>
<a rel="nofollow" href="https://fronkonstin.com/359978_20180523221324/" target="_blank"><img data-orig-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/359978_20180523221324.png?fit=2400%2C2400&amp;ssl=1" data-orig-size="2400,2400" data-medium-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/359978_20180523221324.png?fit=300%2C300&amp;ssl=1" data-attachment-id="4539" data-image-meta="{" src="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/359978_20180523221324.png?fit=300%2C300&ssl=1" data-image-description="" data-permalink="https://fronkonstin.com/359978_20180523221324/" data-large-file="https://i2.wp.com/fronkonstin.com/wp-content/uploads/2018/05/359978_20180523221324.png?fit=604%2C604&amp;ssl=1" alt="" data-image-title="359978_20180523221324" sizes="(max-width: 300px) 100vw, 300px" width="300" data-comments-opened="1" height="300"></a></p>
<p>Just two <em>technical</em> things to highlight:</p>
<ul>
<li>There is a package called sudoku that generates sudokus (of course!). I use it to obtain the first solved sudoku which forms the base.</li>
<li>Subsequent sudokus are obtained from this one doing two operations: interchanging groups of columns first (there are three groups: columns 1 to 3, 4 to 6 and 7 to 9) and interchanging columns within each group then.</li>
</ul>
<p>You can find the code <a rel="nofollow" href="https://github.com/aschinchon/sudokus-colored" target="_blank">here</a>: do you own colored n-dokus!</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://fronkonstin.com/2018/06/01/coloring-sudokus/"> R – Fronkonstin</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/SWHdvteywRk" height="1"></a></div>