[{"id":247301,"date":"2026-07-03T21:50:36","date_gmt":"2026-07-04T02:50:36","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247301"},"modified":"2026-07-04T08:12:32","modified_gmt":"2026-07-04T13:12:32","slug":"does-additional-data-always-reduce-posterior-variance","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/07\/03\/does-additional-data-always-reduce-posterior-variance\/","title":{"rendered":"Does additional data always reduce posterior variance?"},"content":{"rendered":"<p>A discussion over lunch today brought up the fact that additional data does not always decrease the size of a confidence interval. This post will look at this from a Bayesian perspective.<\/p>\n<p>In general, new information reduces your uncertainty regarding whatever you&#8217;re estimating. The posterior distribution becomes more concentrated as more data are collected.<\/p>\n<p>That&#8217;s what happens &#8220;in general&#8221; but does it necessarily happen every time you get new data? Conceivably if you get surprising data, data that is very unlikely given your current prior, posterior uncertainty might increase.<\/p>\n<h2>Binomial-beta model<\/h2>\n<p>To show that this is the case, suppose the probability of success in some binary trial has parameter \u03b8 and that \u03b8 has a beta prior. You could imagine this prior to be the posterior after having made some number of previous observations. Can a new observation increase the posterior variance in \u03b8? If so, under what conditions?<\/p>\n<p>The variance of a beta(<em>a<\/em>, <em>b<\/em>) random variable is<\/p>\n<p style=\"padding-left: 40px;\"><em>ab<\/em> \/ (<em>a<\/em> + <em>b<\/em>)\u00b2(<em>a<\/em> + <em>b<\/em> + 1).<\/p>\n<p>After observing a successful trial, the posterior distribution on \u03b8 is beta(<em>a<\/em> + 1, <em>b<\/em>). We can calculate the ratio of the posterior variance to the prior variance and ask under what circumstances, if any, the ratio is greater than 1.<\/p>\n<p>If 2<em>a<\/em> \u2265 <em>b<\/em> the posterior variance will be strictly less than the prior variance. This says if the prior mean odds against a success are no more than 2 : 1, observing a success will reduce the variance. (So will observing a failure.) But for any value of <em>b<\/em>, you can find a small enough value of\u00a0<em>a<\/em> that observing a success will increase the variance.<\/p>\n<h2>Normal-normal model<\/h2>\n<p>Whether an observation can increase the posterior variance depends on the data model. If your data have a normal likelihood function with known variance and a normal prior on the mean \u03b8, the posterior variance is always less than the prior observation, and it reduces by the same amount, independent of the observation\u00a0<em>x<\/em>. If <em>x<\/em> is very unlikely <em>a priori<\/em> then it will pull the posterior mean toward itself more than an observation that is more concordant with the prior would have, but the change in the posterior variance is the same.<\/p>\n<h2>Proof of beta theorem<\/h2>\n<p>Here is a proof in Lean 4 of the statement above that if 2<em>a<\/em> \u2265 <em>b<\/em> the posterior variance will be strictly less than the prior variance.<\/p>\n<pre>\r\nimport Mathlib\r\n\r\nset_option linter.style.header false\r\n\r\nnoncomputable def f (a b : \u211d) : \u211d := a * b \/ ((a + b) ^ 2 * (a + b + 1))\r\n\r\ntheorem f_ratio_lt_one' (a b : \u211d) (ha : 0 < a) (hb : 0 < b) (hab : b \u2264 2 * a) :\r\n    f (a + 1) b \/ f a b < 1 := by\r\n  have hs : 0 < a + b := by linarith\r\n  have h2ab : 0 \u2264 2 * a - b := by linarith\r\n  have hprod : 0 \u2264 (a + b) * (2 * a - b) := mul_nonneg hs.le h2ab\r\n  -- key polynomial inequality (\u2217)\r\n  have key : (a + 1) * (a + b) ^ 2 < a * ((a + b + 1) * (a + b + 2)) := by\r\n    nlinarith [hprod, ha]\r\n  -- nonzero facts needed to clear denominators\r\n  have ha' : a \u2260 0 := ne_of_gt ha\r\n  have hb' : b \u2260 0 := ne_of_gt hb\r\n  have hs' : a + b \u2260 0 := ne_of_gt hs\r\n  have hs1' : a + b + 1 \u2260 0 := by positivity\r\n  have hs2' : a + b + 2 \u2260 0 := by positivity\r\n  have ha1' : a + 1 \u2260 0 := by positivity\r\n  -- express the ratio as a single closed-form fraction\r\n  have hratio : f (a + 1) b \/ f a b\r\n      = ((a + 1) * (a + b) ^ 2) \/ (a * ((a + b + 1) * (a + b + 2))) := by\r\n    unfold f\r\n    have e : a + 1 + b = a + b + 1 := by ring\r\n    rw [e]\r\n    field_simp\r\n    ring\r\n  rw [hratio, div_lt_one (by positivity)]\r\n  exact key\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A discussion over lunch today brought up the fact that additional data does not always decrease the size of a confidence interval. This post will look at this from a Bayesian perspective. In general, new information reduces your uncertainty regarding whatever you&#8217;re estimating. The posterior distribution becomes more concentrated as more data are collected. That&#8217;s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[25,324],"class_list":["post-247301","post","type-post","status-publish","format-standard","hentry","category-math","tag-bayesian","tag-formal-methods"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Observing data that is moderately concordant with what you&#039;ve seen before decreases posterior variance. But discordant data could increase posterior variance.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"bayesian,formal methods\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/07\/03\/does-additional-data-always-reduce-posterior-variance\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Does additional data always reduce posterior variance?\" \/>\n\t\t<meta property=\"og:description\" content=\"Observing data that is moderately concordant with what you&#039;ve seen before decreases posterior variance. But discordant data could increase posterior variance.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/07\/03\/does-additional-data-always-reduce-posterior-variance\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-07-04T02:50:36+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-07-04T13:12:32+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Does additional data always reduce posterior variance?\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Observing data that is moderately concordant with what you&#039;ve seen before decreases posterior variance. But discordant data could increase posterior variance.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Does additional data always reduce posterior variance?","description":"Observing data that is moderately concordant with what you've seen before decreases posterior variance. But discordant data could increase posterior variance.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/07\/03\/does-additional-data-always-reduce-posterior-variance\/","robots":"max-image-preview:large","keywords":"bayesian,formal methods","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Does additional data always reduce posterior variance?","og:description":"Observing data that is moderately concordant with what you've seen before decreases posterior variance. But discordant data could increase posterior variance.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/07\/03\/does-additional-data-always-reduce-posterior-variance\/","article:published_time":"2026-07-04T02:50:36+00:00","article:modified_time":"2026-07-04T13:12:32+00:00","twitter:card":"summary","twitter:title":"Does additional data always reduce posterior variance?","twitter:description":"Observing data that is moderately concordant with what you've seen before decreases posterior variance. But discordant data could increase posterior variance.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247301","title":null,"description":"Observing data that is moderately concordant with what you've seen before decreases posterior variance. But discordant data could increase posterior variance.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-07-04 02:07:44","updated":"2026-07-04 13:12:32","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDoes additional data always reduce posterior variance?\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Does additional data always reduce posterior variance?","link":"https:\/\/www.johndcook.com\/blog\/2026\/07\/03\/does-additional-data-always-reduce-posterior-variance\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247301"}],"version-history":[{"count":4,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247301\/revisions"}],"predecessor-version":[{"id":247305,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247301\/revisions\/247305"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247287,"date":"2026-06-30T19:21:21","date_gmt":"2026-07-01T00:21:21","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247287"},"modified":"2026-07-01T10:46:31","modified_gmt":"2026-07-01T15:46:31","slug":"dna-sequence-alignment-and-kings","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/dna-sequence-alignment-and-kings\/","title":{"rendered":"DNA Sequence Alignment and Kings"},"content":{"rendered":"<p><a href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/silver-kings\/\">This morning<\/a> I wrote a post that included the central Delannoy numbers. The\u00a0<em>n<\/em>th central Delannoy number\u00a0<em>D<\/em><sub><em>n<\/em><\/sub> counts the number of ways a king can move from one corner of a chessboard to the diagonally opposite corner without backtracking.<\/p>\n<p>The more general Delannoy numbers <em>D<\/em><sub><em>m<\/em>,<em>n<\/em><\/sub> are the analogy for an <em>m<\/em> \u00d7 <em>n<\/em> rectangular board, not necessarily square.<\/p>\n<p><em>D<\/em><sub><em>m<\/em>,<em>n<\/em><\/sub> is also the number of possible sequence alignments for a strand of DNA with <em>m<\/em> base pairs and a strand with <em>n<\/em> base pairs [1]. At each step in the alignment process, you can introduce a gap in the first strand, the second strand or neither, which is analogous to the king who can move N, E, or NE at each step.<\/p>\n<p>The Delannoy numbers can be computed recursively:<\/p>\n<pre>def D(m, n):\r\n    if m == 0 or n == 0:\r\n        return 1\r\n    return D(m - 1, n) + D(m, n - 1) + D(m - 1, n - 1)\r\n<\/pre>\n<p>The code above can be sped up tremendously by adding the decorator<\/p>\n<pre>@lru_cache(maxsize=None)<\/pre>\n<p>above the function definition to turn on memoization. I did an experiment computing <em>D<\/em><sub>12,15<\/sub> with and without memoization and the times were 77.1805 seconds and 0.000062 seconds respectively, i.e. memoization made the code over a million times faster.<\/p>\n<p>Incidentally, <em>D<\/em><sub>12,15<\/sub> = 2653649025 and so there are a <em>lot<\/em> of ways to align even short sequences unless you place some restriction on the permissible alignments.<\/p>\n<p><strong>Update<\/strong>: Here&#8217;s a heatmap plotting log<sub>10<\/sub>(<em>D<\/em><sub><em>m<\/em>,<em>n<\/em><\/sub>). Obviously the function increases with\u00a0<em>m<\/em> and\u00a0<em>n<\/em>: bigger chessboards have more possible paths. Moreover, it&#8217;s larger along the diagonal (i.e. the <em>central<\/em> Delannoy numbers). If you look along northeast to southwest diagonals, the function is largest in the middle where <em>m<\/em> = <em>n<\/em>. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/delannoy_heatmap.png\" width=\"500\" height=\"375\" \/><\/p>\n<p>[1] Torres, A., Cabada, A., &amp; Nieto, J. J. (2003). An exact formula for the number of alignments between two DNA sequences. <em>DNA Sequence, 14<\/em>(6), 427\u2013430. https:\/\/doi.org\/10.1080\/10425170310001617894<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This morning I wrote a post that included the central Delannoy numbers. The\u00a0nth central Delannoy number\u00a0Dn counts the number of ways a king can move from one corner of a chessboard to the diagonally opposite corner without backtracking. The more general Delannoy numbers Dm,n are the analogy for an m \u00d7 n rectangular board, not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[197,60],"class_list":["post-247287","post","type-post","status-publish","format-standard","hentry","category-math","tag-combinatorics","tag-genetics"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"How DNA sequence alignment and a chess problem have the same combinatorics.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"combinatorics,genetics\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/dna-sequence-alignment-and-kings\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"DNA sequence alignment and Delannoy numbers\" \/>\n\t\t<meta property=\"og:description\" content=\"How DNA sequence alignment and a chess problem have the same combinatorics.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/dna-sequence-alignment-and-kings\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-07-01T00:21:21+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-07-01T15:46:31+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"DNA sequence alignment and Delannoy numbers\" \/>\n\t\t<meta name=\"twitter:description\" content=\"How DNA sequence alignment and a chess problem have the same combinatorics.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"DNA sequence alignment and Delannoy numbers","description":"How DNA sequence alignment and a chess problem have the same combinatorics.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/dna-sequence-alignment-and-kings\/","robots":"max-image-preview:large","keywords":"combinatorics,genetics","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"DNA sequence alignment and Delannoy numbers","og:description":"How DNA sequence alignment and a chess problem have the same combinatorics.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/dna-sequence-alignment-and-kings\/","article:published_time":"2026-07-01T00:21:21+00:00","article:modified_time":"2026-07-01T15:46:31+00:00","twitter:card":"summary","twitter:title":"DNA sequence alignment and Delannoy numbers","twitter:description":"How DNA sequence alignment and a chess problem have the same combinatorics.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247287","title":"DNA sequence alignment and Delannoy numbers","description":"How DNA sequence alignment and a chess problem have the same combinatorics.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-06-30 23:44:52","updated":"2026-07-01 18:17:58","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDNA Sequence Alignment and Kings\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"DNA Sequence Alignment and Kings","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/dna-sequence-alignment-and-kings\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247287","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247287"}],"version-history":[{"count":7,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247287\/revisions"}],"predecessor-version":[{"id":247294,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247287\/revisions\/247294"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247281,"date":"2026-06-30T13:51:36","date_gmt":"2026-06-30T18:51:36","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247281"},"modified":"2026-07-02T08:31:13","modified_gmt":"2026-07-02T13:31:13","slug":"variables-and-parameters","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/variables-and-parameters\/","title":{"rendered":"Distinguishing variables from parameters"},"content":{"rendered":"<p>Imagine the following dialog.<\/p>\n<p style=\"padding-left: 40px;\"><strong>Professor<\/strong>:\u00a0<em>f<\/em> is a function of a real variable\u00a0<em>x<\/em> that takes a real parameter\u00a0<em>k<\/em>.<\/p>\n<p style=\"padding-left: 40px;\"><strong>Student<\/strong>: What&#8217;s a parameter?<\/p>\n<p style=\"padding-left: 40px;\"><strong>Professor<\/strong>: It&#8217;s a constant that can vary.<\/p>\n<p style=\"padding-left: 40px;\"><strong>Student<\/strong>: Then if it can vary, isn&#8217;t it a variable?<\/p>\n<p style=\"padding-left: 40px;\"><strong>Professor<\/strong>: Sorta, but no not really.<\/p>\n<p>This conversation plays out over and over, and unfortunately it often ends as it does above, with the student confused. Here&#8217;s how I believe the conversation should continue.<\/p>\n<p style=\"padding-left: 40px;\"><strong>Professor<\/strong>: You&#8217;re absolutely right that <em>f<\/em> is a function of two variables,\u00a0<em>x<\/em> and\u00a0<em>k<\/em>. But usually <em>k<\/em> is fixed in the context of a specific application and\u00a0<em>x<\/em> is not. A different application might have a different, but also fixed, value of <em>k<\/em>. So it is helpful to think of\u00a0<em>f<\/em>(<em>x<\/em>;\u00a0<em>k<\/em>), a function of\u00a0<em>x<\/em> with a parameter\u00a0<em>k<\/em>, rather than\u00a0<em>f<\/em>(<em>x<\/em>,\u00a0<em>k<\/em>), a function of two variables. The former carries more information, giving a hint as to how the numbers are used.<\/p>\n<p>Is there really a difference between a parameter and a variable? In a reductionistic sense, no. But in a practical sense, yes, absolutely.<\/p>\n<p>It might sound pedantic to distinguish a variable from a parameter, and it is, in the best sense of the word. Pedant literally means teacher. Usually <em>pedantic<\/em> carries a negative connotation, such as making a distinction without a difference. But here the pedant would be making a helpful distinction.<\/p>\n<p>For example, we might write a probability density function as <em>f<\/em>(<em>x<\/em>; \u03bc, \u03c3). The function gives the probability density at a point\u00a0<em>x<\/em>. The density depends on parameters \u03bc and \u03c3, and these parameters change between applications, but for a given application they have fixed values.<\/p>\n<p>You find the probability of a random variable taking on values in an interval [<em>a<\/em>,\u00a0<em>b<\/em>] by integrating\u00a0<em>f<\/em> over that interval. When I say that, you know that I mean you&#8217;d integrate with respect to\u00a0<em>x<\/em>, because\u00a0<em>f<\/em> is a function of\u00a0<em>x<\/em>. It is also, in an abstract sense, a function of \u03bc and \u03c3, but it&#8217;s typically not useful to think of it that way.<\/p>\n<p>Hypergeometric functions have two sets of parameters, and so you may see two semicolons, such as\u00a0<em>f<\/em>(<em>x<\/em>;\u00a0<em>a<\/em>,\u00a0<em>b<\/em>;\u00a0<em>c<\/em>). This denotes a function of the variable\u00a0<em>x<\/em>, with upper parameters\u00a0<em>a<\/em> and\u00a0<em>b<\/em>, and a lower parameter\u00a0<em>c<\/em>. In some abstract sense this is a function of four variables, but it acts very differently with respect to\u00a0<em>x<\/em> than with respect to\u00a0<em>a<\/em>,\u00a0<em>b<\/em>, and\u00a0<em>c<\/em>. There&#8217;s also a difference between\u00a0<em>a<\/em> and\u00a0<em>b<\/em> on the one hand and\u00a0<em>c<\/em> on the other, one worth paying attention to, though it is less of a difference than between\u00a0<em>x<\/em> and the parameters collectively.<\/p>\n<p>Sometimes you&#8217;ll see a vertical bar rather than a semicolon to separate variables from parameters. This works out even better for probability densities because then <em>f<\/em>(<em>x<\/em> | \u03bc, \u03c3) suggests the probability density of <em>x<\/em> <em>given<\/em> \u03bc and \u03c3 since the vertical bar is also used for conditional probability. You might also see\u00a0<em>f<\/em>(<em>x<\/em> |\u00a0<em>a, b;<\/em>\u00a0c) for hypergeometric functions, with the vertical bar separating variables from parameters and the semicolon separating two kinds of parameters.<\/p>\n<p>When I first saw a semicolon separating variables from parameters, no explanation was given, and I figured I could mentally replace the semicolon with a comma. Then later I realized that the semicolon was an act of kindness by the author giving the reader additional information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Imagine the following dialog. Professor:\u00a0f is a function of a real variable\u00a0x that takes a real parameter\u00a0k. Student: What&#8217;s a parameter? Professor: It&#8217;s a constant that can vary. Student: Then if it can vary, isn&#8217;t it a variable? Professor: Sorta, but no not really. This conversation plays out over and over, and unfortunately it often [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[93],"class_list":["post-247281","post","type-post","status-publish","format-standard","hentry","category-math","tag-notation"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"The distinction between a variable and a parameter may seem unnecessary or even nonsensical, but it&#039;s very useful when done thoughtfully.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"notation\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/variables-and-parameters\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Distinguishing variables from parameters\" \/>\n\t\t<meta property=\"og:description\" content=\"The distinction between a variable and a parameter may seem unnecessary or even nonsensical, but it&#039;s very useful when done thoughtfully.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/variables-and-parameters\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-06-30T18:51:36+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-07-02T13:31:13+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Distinguishing variables from parameters\" \/>\n\t\t<meta name=\"twitter:description\" content=\"The distinction between a variable and a parameter may seem unnecessary or even nonsensical, but it&#039;s very useful when done thoughtfully.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Distinguishing variables from parameters","description":"The distinction between a variable and a parameter may seem unnecessary or even nonsensical, but it's very useful when done thoughtfully.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/variables-and-parameters\/","robots":"max-image-preview:large","keywords":"notation","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Distinguishing variables from parameters","og:description":"The distinction between a variable and a parameter may seem unnecessary or even nonsensical, but it's very useful when done thoughtfully.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/variables-and-parameters\/","article:published_time":"2026-06-30T18:51:36+00:00","article:modified_time":"2026-07-02T13:31:13+00:00","twitter:card":"summary","twitter:title":"Distinguishing variables from parameters","twitter:description":"The distinction between a variable and a parameter may seem unnecessary or even nonsensical, but it's very useful when done thoughtfully.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247281","title":null,"description":"The distinction between a variable and a parameter may seem unnecessary or even nonsensical, but it's very useful when done thoughtfully.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-06-30 16:48:14","updated":"2026-07-04 02:05:58","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDistinguishing variables from parameters\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Distinguishing variables from parameters","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/variables-and-parameters\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247281","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247281"}],"version-history":[{"count":6,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247281\/revisions"}],"predecessor-version":[{"id":247300,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247281\/revisions\/247300"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247278,"date":"2026-06-30T09:36:14","date_gmt":"2026-06-30T14:36:14","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247278"},"modified":"2026-07-02T08:30:27","modified_gmt":"2026-07-02T13:30:27","slug":"silver-kings","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/silver-kings\/","title":{"rendered":"Silver Rectangles and the Ways of Kings"},"content":{"rendered":"<h2>Golden rectangles<\/h2>\n<p>The defining property of golden rectangle is that if you stick a square on its longer side, you get another golden rectangle.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/golden_rectangle.png\" width=\"263\" height=\"188\" \/><\/p>\n<p>The smaller vertical rectangle is similar to the larger horizontal rectangle. This means<\/p>\n<p style=\"padding-left: 40px;\">\u03c6 \/ 1 = (1 + \u03c6) \/ \u03c6<\/p>\n<p>which tells us \u03c6\u00b2 = 1 + \u03c6 and so the golden ratio \u03c6 equals (1 + \u221a5)\/2.<\/p>\n<h2>Silver rectangles<\/h2>\n<p>A silver rectangle is one that if you stick <em>two<\/em> squares on its longer side you get another rectangle with the same aspect ratio.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium aligncenter\" src=\"https:\/\/www.johndcook.com\/silver_rectangle.png\" width=\"530\" height=\"254\" \/><\/p>\n<p>This tells us<\/p>\n<p style=\"padding-left: 40px;\">\u03c3 \/ 1 = (1 + 2\u03c3) \/ \u03c3<\/p>\n<p>and so \u03c3\u00b2 = 1 + 2\u03c3 and the silver ratio is \u03c3 = 1 + \u221a2.<\/p>\n<p>Just as you can define a golden ratio and a silver ratio, there&#8217;s an analogous way to define a sequence of <a href=\"https:\/\/www.johndcook.com\/blog\/2023\/04\/14\/metallic-ratios\/\">metallic ratios<\/a>.<\/p>\n<h2>Kings and Delannoy numbers<\/h2>\n<p>The silver ratio has several connections to the ways of ways kings. By that I mean the number of ways a king can go from one corner of a chessboard to the diagonally opposite corner without backtracking.<\/p>\n<p>A king can move one space in any direction. If we start with a king in the bottom left corner of the board, the no-backtracking requirement means the king can move up, right, or up and right.<\/p>\n<p>The number of paths a king can take from one corner to the opposite corner of an <em>n<\/em> \u00d7 <em>n<\/em> chessboard is the <em>n<\/em>th central Delannoy number <em>D<\/em><sub><em>n<\/em><\/sub>. more generally Delannoy numbers are defined for an <em>m<\/em> \u00d7 <em>n<\/em> chessboard, but I&#8217;ll stick to the case\u00a0<em>m<\/em> =\u00a0<em>n<\/em> called the\u00a0<em>central<\/em> Delannoy number, or just Delannoy numbers for short.<\/p>\n<p>The first Delannoy number is 1 because there&#8217;s only one way for a king to get from one corner to the other: do nothing, because the opposite corner is the same corner. The second Delannoy number is 3 because the king can move up then right, or right then up, or move diagonally up and right.<\/p>\n<p>For a 3 \u00d7 3 grid things are significantly more complicated, and <em>D<\/em><sub>3<\/sub> = 13. For an 8 \u00d7 8 grid the number of paths is 48,639.<\/p>\n<h2>Generating function<\/h2>\n<p>How would you estimate the number of paths on an <em>n<\/em> \u00d7 <em>n<\/em> board for large values of <em>n<\/em> without calculating it exactly? You might start by finding a generating function for the Delannoy numbers, which works out to be<\/p>\n<p style=\"padding-left: 40px;\">(<em>x<\/em>\u00b2 \u2212 6<em>x<\/em> + 1)<sup>\u22121\/2<\/sup><\/p>\n<p>The radius of convergence <em>r<\/em> for the generating function series is the distance from 0 to the closest singularity of the generating function, which is the smaller root of<\/p>\n<p style=\"padding-left: 40px;\"><em>x<\/em>\u00b2 \u2212 6<em>x<\/em> + 1<\/p>\n<p>which is<\/p>\n<p style=\"padding-left: 40px;\">3 \u2212 \u221a8 = (3 + \u221a8)<sup>\u22121<\/sup> = (1 + \u221a2)<sup>\u22122<\/sup> = 1\/\u03c3\u00b2<\/p>\n<p>i.e. the radius of convergence is the reciprocal of the silver ratio squared.<\/p>\n<h2>Asymptotic estimate<\/h2>\n<p>The radius of convergence gives us a first approximation to the asymptotic size of the series coefficients. Since we&#8217;re working with the generating function of the Delannoy numbers, these coefficients are the Delannoy numbers. That is,<\/p>\n<p style=\"padding-left: 40px;\"><em>D<\/em><sub><em>n<\/em><\/sub> ~ <em>r<\/em><sup>\u2212<em>n<\/em><\/sup> = (\u03c3<sup>2<\/sup>)<sup><em>n<\/em><\/sup> = \u03c3<sup>2<em>n<\/em><\/sup>.<\/p>\n<p>That&#8217;s as good as you can do just knowing the radius of convergence. A more careful analysis would refine this estimate by dividing by a factor proportional to \u221a<em>n<\/em>.<\/p>\n<h2>Related posts<\/h2>\n<ul>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2009\/05\/20\/the-silver-ratio\/'>The silver ratio<\/a><\/li>\n<li class='link'><a href='https:\/\/www.johndcook.com\/blog\/2011\/04\/13\/a-magic-kings-tour\/'>A magic king&#8217;s tour<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Golden rectangles The defining property of golden rectangle is that if you stick a square on its longer side, you get another golden rectangle. The smaller vertical rectangle is similar to the larger horizontal rectangle. This means \u03c6 \/ 1 = (1 + \u03c6) \/ \u03c6 which tells us \u03c6\u00b2 = 1 + \u03c6 and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[33,197],"class_list":["post-247278","post","type-post","status-publish","format-standard","hentry","category-math","tag-chess","tag-combinatorics"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Silver rectangles and a connection to counting the number of ways a king can move from one corner of the chessboard to the opposite corner\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"chess,combinatorics\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/silver-kings\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Silver Rectangles and the Ways of Kings\" \/>\n\t\t<meta property=\"og:description\" content=\"Silver rectangles and a connection to counting the number of ways a king can move from one corner of the chessboard to the opposite corner\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/silver-kings\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-06-30T14:36:14+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-07-02T13:30:27+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Silver Rectangles and the Ways of Kings\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Silver rectangles and a connection to counting the number of ways a king can move from one corner of the chessboard to the opposite corner\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Silver Rectangles and the Ways of Kings","description":"Silver rectangles and a connection to counting the number of ways a king can move from one corner of the chessboard to the opposite corner","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/silver-kings\/","robots":"max-image-preview:large","keywords":"chess,combinatorics","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Silver Rectangles and the Ways of Kings","og:description":"Silver rectangles and a connection to counting the number of ways a king can move from one corner of the chessboard to the opposite corner","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/silver-kings\/","article:published_time":"2026-06-30T14:36:14+00:00","article:modified_time":"2026-07-02T13:30:27+00:00","twitter:card":"summary","twitter:title":"Silver Rectangles and the Ways of Kings","twitter:description":"Silver rectangles and a connection to counting the number of ways a king can move from one corner of the chessboard to the opposite corner","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247278","title":null,"description":"Silver rectangles and a connection to counting the number of ways a king can move from one corner of the chessboard to the opposite corner","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-06-30 12:51:52","updated":"2026-07-04 02:05:58","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tSilver Rectangles and the Ways of Kings\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Silver Rectangles and the Ways of Kings","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/30\/silver-kings\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247278"}],"version-history":[{"count":3,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247278\/revisions"}],"predecessor-version":[{"id":247299,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247278\/revisions\/247299"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247274,"date":"2026-06-29T20:06:12","date_gmt":"2026-06-30T01:06:12","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247274"},"modified":"2026-06-29T20:06:12","modified_gmt":"2026-06-30T01:06:12","slug":"derivative-equals-inverse","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/derivative-equals-inverse\/","title":{"rendered":"Derivative equals inverse"},"content":{"rendered":"<p>Here&#8217;s kind of a strange problem with an interesting solution: find a function\u00a0<em>f<\/em> such that the derivative of\u00a0<em>f<\/em> equals the inverse of\u00a0<em>f<\/em> for all positive <em>x<\/em>.<\/p>\n<p style=\"padding-left: 40px;\"><em>f<\/em>\u2009\u2032(<em>x<\/em>) =\u00a0<em>f<\/em><sup>\u22121<\/sup>(<em>x<\/em>)<\/p>\n<p>This is a differential equation, but a very unusual one, one that cannot be solved using any of the techniques taught in a class on differential equations.<\/p>\n<p>The unique solution is<\/p>\n<p style=\"padding-left: 40px;\"><em>f<\/em>(<em>x<\/em>) = \u03c6(<em>x<\/em> \/ \u03c6)<sup>\u03c6<\/sup><\/p>\n<p>where \u03c6 is the golden ratio. What an unexpected appearance of the golden ratio!<\/p>\n<p>The problem was proposed by H. L. Nelson and solved by A. C. Hindmarsh. See The American Mathematical Monthly, Vol. 76, No. 6 p. 696.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s kind of a strange problem with an interesting solution: find a function\u00a0f such that the derivative of\u00a0f equals the inverse of\u00a0f for all positive x. f\u2009\u2032(x) =\u00a0f\u22121(x) This is a differential equation, but a very unusual one, one that cannot be solved using any of the techniques taught in a class on differential equations. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[47],"class_list":["post-247274","post","type-post","status-publish","format-standard","hentry","category-math","tag-differential-equations"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Find a function whose derivative is its inverse.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"differential equations\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/derivative-equals-inverse\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Derivative equals inverse\" \/>\n\t\t<meta property=\"og:description\" content=\"Find a function whose derivative is its inverse.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/derivative-equals-inverse\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-06-30T01:06:12+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-06-30T01:06:12+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Derivative equals inverse\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Find a function whose derivative is its inverse.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Derivative equals inverse","description":"Find a function whose derivative is its inverse.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/derivative-equals-inverse\/","robots":"max-image-preview:large","keywords":"differential equations","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Derivative equals inverse","og:description":"Find a function whose derivative is its inverse.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/derivative-equals-inverse\/","article:published_time":"2026-06-30T01:06:12+00:00","article:modified_time":"2026-06-30T01:06:12+00:00","twitter:card":"summary","twitter:title":"Derivative equals inverse","twitter:description":"Find a function whose derivative is its inverse.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247274","title":null,"description":"Find a function whose derivative is its inverse.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-06-30 00:39:55","updated":"2026-06-30 09:26:58","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDerivative equals inverse\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Derivative equals inverse","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/derivative-equals-inverse\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247274"}],"version-history":[{"count":3,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247274\/revisions"}],"predecessor-version":[{"id":247277,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247274\/revisions\/247277"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247268,"date":"2026-06-29T07:12:05","date_gmt":"2026-06-29T12:12:05","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247268"},"modified":"2026-06-29T12:10:59","modified_gmt":"2026-06-29T17:10:59","slug":"who-you-gonna-believe","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/who-you-gonna-believe\/","title":{"rendered":"Who you gonna believe: Grok or the docs?"},"content":{"rendered":"<p>The calculator utility <code>bc<\/code> has a minimal math library. For example, there&#8217;s no tangent function because you&#8217;re expected take the ratio of sine and cosine. (The Gnu version of <code>bc<\/code> does have a function for tangent, but the POSIX version does not.) And yet <code>bc<\/code> includes support for Bessel functions <em>J<\/em>(<em>x<\/em>).<\/p>\n<p>The <code>bc<\/code> function <code>j<\/code> takes two arguments. Is the first argument <em>n<\/em> or <em>x<\/em>? Grok said the function arguments are <code>j(n,x)<\/code>. I thought I should run <code>man bc<\/code> just to make sure, and it said<\/p>\n<blockquote><p>j(x, n) Returns the bessel integer order n (truncated) of x.<\/p><\/blockquote>\n<p>So Grok says <code>j(n,x)<\/code> and the documentation that ships with the software says <code>j(x,n)<\/code>. Which one should you believe? Neither! You should run a little test.<\/p>\n<pre>~$ bc -l\r\n&gt;&gt;&gt; j(1, 0)\r\n0\r\n&gt;&gt;&gt; j(0, 1)\r\n.76519768655796655144\r\n<\/pre>\n<p>Now <em>J<\/em><sub>1<\/sub>(0) = 0, so apparently the first argument is the order <em>n<\/em>. Grok was right and the man page was wrong.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/who_you_gonna_believe.jpeg\" alt=\"Groucho Marx saysing \" width=\"480\" height=\"349\" \/><\/p>\n<p>As further confirmation, let&#8217;s see which argument is truncated.<\/p>\n<pre>&gt;&gt;&gt; j(1.2, 3.4)\r\n.17922585168150711099\r\n&gt;&gt;&gt; j(1, 3.4)\r\n.17922585168150711099\r\n&gt;&gt;&gt; j(1.2, 3)\r\n.33905895852593645892\r\n<\/pre>\n<p>The first argument is truncated to an integer value, so that&#8217;s the order <em>n<\/em>.<\/p>\n<p>Turns out there&#8217;s a bug in the man page. The man page text above comes from running <code>man bc<\/code> on my Macbook. On my Linux box, the documentation is correct. It says<\/p>\n<blockquote><p>j(n,x) The Bessel function of integer order n of x.<\/p><\/blockquote>\n<p>The software produces the same results on both computers. It&#8217;s just a documentation bug.<\/p>\n<p>The version running on my Macbook is the version that ships with the OS. It&#8217;s not the Gnu version, though the documentation says &#8220;This bc is compatible with both the GNU bc and the POSIX bc spec.&#8221; It has a function <code>t<\/code> for tangent, for example, which a POSIX version does not. But if you run <code>bc --standard -l<\/code> attempting to call <code>t<\/code> produces an error.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The calculator utility bc has a minimal math library. For example, there&#8217;s no tangent function because you&#8217;re expected take the ratio of sine and cosine. (The Gnu version of bc does have a function for tangent, but the POSIX version does not.) And yet bc includes support for Bessel functions J(x). The bc function j [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-247268","post","type-post","status-publish","format-standard","hentry","category-computing"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"When AI and the software docs conflict, which will you believe? How to decide?\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/who-you-gonna-believe\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Who you gonna believe: Grok or the docs?\" \/>\n\t\t<meta property=\"og:description\" content=\"When AI and the software docs conflict, which will you believe? How to decide?\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/who-you-gonna-believe\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-06-29T12:12:05+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-06-29T17:10:59+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Who you gonna believe: Grok or the docs?\" \/>\n\t\t<meta name=\"twitter:description\" content=\"When AI and the software docs conflict, which will you believe? How to decide?\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Who you gonna believe: Grok or the docs?","description":"When AI and the software docs conflict, which will you believe? How to decide?","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/who-you-gonna-believe\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Who you gonna believe: Grok or the docs?","og:description":"When AI and the software docs conflict, which will you believe? How to decide?","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/who-you-gonna-believe\/","article:published_time":"2026-06-29T12:12:05+00:00","article:modified_time":"2026-06-29T17:10:59+00:00","twitter:card":"summary","twitter:title":"Who you gonna believe: Grok or the docs?","twitter:description":"When AI and the software docs conflict, which will you believe? How to decide?","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247268","title":null,"description":"When AI and the software docs conflict, which will you believe? How to decide?","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-06-29 11:12:27","updated":"2026-06-29 17:10:59","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/computing\/\" title=\"Computing\">Computing<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWho you gonna believe: Grok or the docs?\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Computing","link":"https:\/\/www.johndcook.com\/blog\/category\/computing\/"},{"label":"Who you gonna believe: Grok or the docs?","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/29\/who-you-gonna-believe\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247268"}],"version-history":[{"count":5,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247268\/revisions"}],"predecessor-version":[{"id":247273,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247268\/revisions\/247273"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247263,"date":"2026-06-27T19:33:33","date_gmt":"2026-06-28T00:33:33","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247263"},"modified":"2026-06-27T19:33:33","modified_gmt":"2026-06-28T00:33:33","slug":"brace-expansion-tree","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/brace-expansion-tree\/","title":{"rendered":"Brace expansion tree"},"content":{"rendered":"<p>Here&#8217;s a crazy bash one-liner I found via an <a href=\"https:\/\/catonmat.net\/bash-one-liners-explained-part-two\">article<\/a> by Peter Krumins:<\/p>\n<pre>echo {w,t,}h{e{n{,ce{,forth}},re{,in,fore,with{,al}}},ither,at}<\/pre>\n<p>This prints 30 English words:<\/p>\n<blockquote><p>when, whence, whenceforth, where, wherein, wherefore, wherewith, wherewithal, whither, what, then, thence, thenceforth, there, therein, therefore, therewith, therewithal, thither, that, hen, hence, henceforth, here, herein, herefore, herewith, herewithal, hither, hat<\/p><\/blockquote>\n<p>This post will explain how the one-liner works.<\/p>\n<p>Bash brace expansion iterates through all possibilities listed within curly braces, with possibilities separated by a comma. Note that the comma is a\u00a0<em>separator<\/em> and not a\u00a0<em>terminator<\/em>. And so, for example, the expression <code>{w,t,}<\/code> is effectively <code>{w,t,\"\"}<\/code>.<\/p>\n<p>When bash sees two brace expressions, these expand to the cartesian product of the two expressions. For example,<\/p>\n<pre>echo {A,B}{1,2,3}<\/pre>\n<p>produces<\/p>\n<pre>A1 A2 A3 B1 B2 B3<\/pre>\n<p>In the expression above we have<\/p>\n<pre>{w,t,}h{e\u2026,ither,at}<\/pre>\n<p>So the expansion will enumerate all possibilities of <code>{w,h,}<\/code> multiplied by all possibilities of <code>{e\u2026,ither,at}<\/code> where <code>e\u2026<\/code> is itself a brace expression.<\/p>\n<p>A diagram will help a lot.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.johndcook.com\/krumins_brace.png\" width=\"480\" height=\"407\" class=\"aligncenter size-medium\" \/><\/p>\n<p>The brace expansion does a depth-first traversal of this tree.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a crazy bash one-liner I found via an article by Peter Krumins: echo {w,t,}h{e{n{,ce{,forth}},re{,in,fore,with{,al}}},ither,at} This prints 30 English words: when, whence, whenceforth, where, wherein, wherefore, wherewith, wherewithal, whither, what, then, thence, thenceforth, there, therein, therefore, therewith, therewithal, thither, that, hen, hence, henceforth, here, herein, herefore, herewith, herewithal, hither, hat This post will explain how [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-247263","post","type-post","status-publish","format-standard","hentry","category-computing"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Bash brace expansions can be very expressive. This post walks through an example by Peter Krumins that expands to 30 English words.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/brace-expansion-tree\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Brace expansion tree\" \/>\n\t\t<meta property=\"og:description\" content=\"Bash brace expansions can be very expressive. This post walks through an example by Peter Krumins that expands to 30 English words.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/brace-expansion-tree\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-06-28T00:33:33+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-06-28T00:33:33+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Brace expansion tree\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Bash brace expansions can be very expressive. This post walks through an example by Peter Krumins that expands to 30 English words.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Brace expansion tree","description":"Bash brace expansions can be very expressive. This post walks through an example by Peter Krumins that expands to 30 English words.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/brace-expansion-tree\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Brace expansion tree","og:description":"Bash brace expansions can be very expressive. This post walks through an example by Peter Krumins that expands to 30 English words.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/brace-expansion-tree\/","article:published_time":"2026-06-28T00:33:33+00:00","article:modified_time":"2026-06-28T00:33:33+00:00","twitter:card":"summary","twitter:title":"Brace expansion tree","twitter:description":"Bash brace expansions can be very expressive. This post walks through an example by Peter Krumins that expands to 30 English words.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247263","title":null,"description":"Bash brace expansions can be very expressive. This post walks through an example by Peter Krumins that expands to 30 English words.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-06-27 22:50:00","updated":"2026-06-29 10:09:57","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/computing\/\" title=\"Computing\">Computing<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tBrace expansion tree\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Computing","link":"https:\/\/www.johndcook.com\/blog\/category\/computing\/"},{"label":"Brace expansion tree","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/brace-expansion-tree\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247263"}],"version-history":[{"count":3,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247263\/revisions"}],"predecessor-version":[{"id":247266,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247263\/revisions\/247266"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247260,"date":"2026-06-27T13:12:03","date_gmt":"2026-06-27T18:12:03","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247260"},"modified":"2026-06-29T05:10:30","modified_gmt":"2026-06-29T10:10:30","slug":"decimal-period","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/decimal-period\/","title":{"rendered":"When will the decimals in a\/b repeat?"},"content":{"rendered":"<p>The previous post looked at how many digits are in the reduced fraction for the\u00a0<em>n<\/em>th harmonic number. I was curious about how long the cycle of digits in a harmonic number might be.<\/p>\n<p>I wrote about the period length for the digits of fractions <a href=\"https:\/\/www.johndcook.com\/blog\/2016\/10\/18\/periods-of-fractions\/\">almost a decade ago<\/a>. This post includes code so I can apply it to harmonic denominators.<\/p>\n<pre>\r\nfrom sympy import lcm, factorint, n_order\r\n\r\ndef period(n):\r\n    factors = factorint(n)\r\n    exp2 = factors.get(2, 0)\r\n    exp5 = factors.get(5, 0)\r\n    r = max(exp2, exp5)\r\n\r\n    d = n \/\/ (2**exp2 * 5**exp5)\r\n    s = 1 if d == 1 else n_order(10, d)\r\n    return (r, s)\r\n<\/pre>\n<p>This function returns two numbers: <em>r<\/em> is the number of non-repeating digits at the beginning and <em>s<\/em> is the length of the repeating part. <\/p>\n<p>The following code<\/p>\n<pre>\r\nfrom functools import reduce\r\n\r\ndef lcm_range(n):\r\n    return reduce(lcm, range(1, n + 1))\r\n\r\nprint( period( lcm_range(50) ) )\r\n<\/pre>\n<p>prints (5, 1275120) meaning that 1\/lcm(1, 2, 3, &hellip;, 49, 50) has five non-repeating digits following by 1,275,120 digits that repeat <em>ad infinitum<\/em>. And so the decimals in the expansion of <em>H<\/em><sub>50<\/sub> have a cycle length of 1,275,120.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The previous post looked at how many digits are in the reduced fraction for the\u00a0nth harmonic number. I was curious about how long the cycle of digits in a harmonic number might be. I wrote about the period length for the digits of fractions almost a decade ago. This post includes code so I can [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[94],"class_list":["post-247260","post","type-post","status-publish","format-standard","hentry","category-math","tag-number-theory"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"How to find out the length of the cycle of repeating digits in a fraction a\/b when b is so large that just computing a\/b and looking isn&#039;t practical.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"number theory\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/decimal-period\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"When will the decimals in a\/b repeat?\" \/>\n\t\t<meta property=\"og:description\" content=\"How to find out the length of the cycle of repeating digits in a fraction a\/b when b is so large that just computing a\/b and looking isn&#039;t practical.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/decimal-period\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-06-27T18:12:03+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-06-29T10:10:30+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"When will the decimals in a\/b repeat?\" \/>\n\t\t<meta name=\"twitter:description\" content=\"How to find out the length of the cycle of repeating digits in a fraction a\/b when b is so large that just computing a\/b and looking isn&#039;t practical.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"When will the decimals in a\/b repeat?","description":"How to find out the length of the cycle of repeating digits in a fraction a\/b when b is so large that just computing a\/b and looking isn't practical.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/decimal-period\/","robots":"max-image-preview:large","keywords":"number theory","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"When will the decimals in a\/b repeat?","og:description":"How to find out the length of the cycle of repeating digits in a fraction a\/b when b is so large that just computing a\/b and looking isn't practical.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/decimal-period\/","article:published_time":"2026-06-27T18:12:03+00:00","article:modified_time":"2026-06-29T10:10:30+00:00","twitter:card":"summary","twitter:title":"When will the decimals in a\/b repeat?","twitter:description":"How to find out the length of the cycle of repeating digits in a fraction a\/b when b is so large that just computing a\/b and looking isn't practical.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247260","title":null,"description":"How to find out the length of the cycle of repeating digits in a fraction a\/b when b is so large that just computing a\/b and looking isn't practical.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-06-27 17:57:22","updated":"2026-06-29 10:11:01","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWhen will the decimals in a\/b repeat?\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"When will the decimals in a\/b repeat?","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/decimal-period\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247260"}],"version-history":[{"count":3,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247260\/revisions"}],"predecessor-version":[{"id":247267,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247260\/revisions\/247267"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247253,"date":"2026-06-27T07:51:42","date_gmt":"2026-06-27T12:51:42","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247253"},"modified":"2026-06-27T07:51:42","modified_gmt":"2026-06-27T12:51:42","slug":"height-of-harmonic-numbers","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/height-of-harmonic-numbers\/","title":{"rendered":"Height of harmonic numbers"},"content":{"rendered":"<p>The <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/26\/writing-down-harmonic-numbers\/\">previous post<\/a> looked at writing the harmonic numbers as reduced fractions and estimating the number of digits in the numerator and denominator based on asymptotics. This is a follow up post with plots.<\/p>\n<p>We&#8217;ll choose our base\u00a0<em>b<\/em> to be 2. And we&#8217;ll look at the total number of bits in both the numerator and denominator, which we will use as the <a href=\"https:\/\/www.johndcook.com\/blog\/2023\/09\/17\/rational-height-functions\/\">height<\/a> of the fractions.<\/p>\n<p>First, let&#8217;s look at the actual and estimated heights, using the estimates from the previous post.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/harmonic_height1.png\" width=\"480\" height=\"360\" \/><\/p>\n<p>Next let&#8217;s look at the difference between the actual and estimated heights.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/harmonic_height2.png\" width=\"480\" height=\"360\" \/><\/p>\n<p>In the previous post I looked at <em>n<\/em> = 50, which was kind of a lucky choice, the error being smaller than usual. I had also looked at, but didn&#8217;t publish, <em>n<\/em> = 100, which would be an unlucky choice.<\/p>\n<p>Finally, let&#8217;s look at the <em>relative<\/em> error in the estimates, and plot over a larger range of <em>n<\/em>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium\" src=\"https:\/\/www.johndcook.com\/harmonic_height3.png\" width=\"480\" height=\"360\" \/><\/p>\n<p>The error goes to zero, as predicted by the asymptotic estimates. And it goes noisily, which you&#8217;d expect since the heights are related to the distribution of primes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The previous post looked at writing the harmonic numbers as reduced fractions and estimating the number of digits in the numerator and denominator based on asymptotics. This is a follow up post with plots. We&#8217;ll choose our base\u00a0b to be 2. And we&#8217;ll look at the total number of bits in both the numerator and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[94],"class_list":["post-247253","post","type-post","status-publish","format-standard","hentry","category-math","tag-number-theory"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Plotting the actual and estimated number of bits in the nth harmonic number.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"number theory\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/height-of-harmonic-numbers\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Height of harmonic numbers\" \/>\n\t\t<meta property=\"og:description\" content=\"Plotting the actual and estimated number of bits in the nth harmonic number.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/height-of-harmonic-numbers\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-06-27T12:51:42+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-06-27T12:51:42+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Height of harmonic numbers\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Plotting the actual and estimated number of bits in the nth harmonic number.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Height of harmonic numbers","description":"Plotting the actual and estimated number of bits in the nth harmonic number.","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/height-of-harmonic-numbers\/","robots":"max-image-preview:large","keywords":"number theory","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Height of harmonic numbers","og:description":"Plotting the actual and estimated number of bits in the nth harmonic number.","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/height-of-harmonic-numbers\/","article:published_time":"2026-06-27T12:51:42+00:00","article:modified_time":"2026-06-27T12:51:42+00:00","twitter:card":"summary","twitter:title":"Height of harmonic numbers","twitter:description":"Plotting the actual and estimated number of bits in the nth harmonic number.","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247253","title":null,"description":"Plotting the actual and estimated number of bits in the nth harmonic number.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-06-27 12:35:46","updated":"2026-06-27 17:57:48","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHeight of harmonic numbers\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Height of harmonic numbers","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/height-of-harmonic-numbers\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247253"}],"version-history":[{"count":4,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247253\/revisions"}],"predecessor-version":[{"id":247257,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247253\/revisions\/247257"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}},{"id":247251,"date":"2026-06-26T20:51:03","date_gmt":"2026-06-27T01:51:03","guid":{"rendered":"https:\/\/www.johndcook.com\/blog\/?p=247251"},"modified":"2026-06-27T07:59:00","modified_gmt":"2026-06-27T12:59:00","slug":"writing-down-harmonic-numbers","status":"publish","type":"post","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/26\/writing-down-harmonic-numbers\/","title":{"rendered":"Writing down harmonic numbers"},"content":{"rendered":"<p>The\u00a0<em>n<\/em>th harmonic number is the sum of the reciprocals of the first\u00a0<em>n<\/em> positive integers.<\/p>\n<p style=\"padding-left: 40px;\"><em>H<\/em><sub><em>n<\/em><\/sub> = 1 + 1\/2 + 1\/3 + 1\/4 + \u2026 + 1\/<em>n<\/em><\/p>\n<p>The product of all the denominators is\u00a0<em>n<\/em>!, so you could write <em>H<\/em><sub><em>n<\/em><\/sub> as a fraction<\/p>\n<p style=\"padding-left: 40px;\"><em>H<\/em><sub><em>n<\/em><\/sub> = <em>p<\/em>\/<em>q<\/em><\/p>\n<p>where\u00a0<em>p<\/em> =\u00a0<em>n<\/em>! <em>H<\/em><sub><em>n<\/em><\/sub> is an integer and <em>q<\/em> =\u00a0<em>n<\/em>!.<\/p>\n<p>While <em>p<\/em>\/<em>q<\/em>\u00a0is <em>a<\/em> way to write <em>H<\/em><sub><em>n<\/em><\/sub> as a fraction, it&#8217;s not the most efficient because\u00a0<em>p<\/em> and\u00a0<em>n<\/em>! will have common factors.<\/p>\n<p>If we write <em>H<\/em><sub><em>n<\/em><\/sub> as a reduced fraction, the denominator will be the least common multiple of the integers 1 through\u00a0<em>n<\/em>. That number is asymptotically exp(<em>n<\/em>). That estimate follows from the prime number theorem.<\/p>\n<p>So for large <em>n<\/em> the denominator will be roughly exp(<em>n<\/em>), and in base\u00a0<em>b<\/em> it would have around<\/p>\n<p style=\"padding-left: 40px;\"><span style=\"background-color: #dee;\"><em>n<\/em>\/log(<em>b<\/em>)<\/span><\/p>\n<p>digits.<\/p>\n<p>The numerator will be exp(<em>n<\/em>) <em>H<\/em><sub><em>n<\/em><\/sub>, and since <em>H<\/em><sub><em>n<\/em><\/sub> is asymptotically log(<em>n<\/em>) + \u03b3, the numerator for large\u00a0<em>n<\/em> will be roughly<\/p>\n<p style=\"padding-left: 40px;\">exp(<em>n<\/em>) (log(<em>n<\/em>) + \u03b3)<\/p>\n<p>and will have around<\/p>\n<p style=\"padding-left: 40px;\"><span style=\"background-color: #dee;\">(<em>n<\/em> + log log(<em>n<\/em>) ) \/ log(<em>b<\/em>)<\/span><\/p>\n<p>digits.<\/p>\n<p>Let&#8217;s see how well our asymptotic estimates work for\u00a0<em>n<\/em> = 50. The 50th harmonic number is<\/p>\n<p style=\"padding-left: 40px;\"><em>H<\/em><sub>50<\/sub> = 13943237577224054960759 \/ 3099044504245996706400.<\/p>\n<p>This fraction has 23 digits in the numerator and 22 in the denominator. We would have predicted around<\/p>\n<p style=\"padding-left: 40px;\">(50 + log(log(50)))\/log(10) = 22.3<\/p>\n<p>digits in the numerator and<\/p>\n<p style=\"padding-left: 40px;\">50\/log(10) = 21.7<\/p>\n<p>digits in the denominator.<\/p>\n<p>Let&#8217;s try a larger example, looking at the 1000th harmonic number in binary. We&#8217;ll use the following Python code.<\/p>\n<pre>from fractions import Fraction\r\n\r\ndef bits(n):\r\n    H = sum(Fraction(i, i+1) for i in range(1, n+1))\r\n    p, q = H.numerator, H.denominator\r\n    # subtract 2 because bin returns a string starting with 0b.\r\n    return len(bin(p)) - 2, len(bin(q)) - 2\r\n\r\nprint(bits(1000))\r\n<\/pre>\n<p>This returns 1448 and 1438. We would have estimated<\/p>\n<p style=\"padding-left: 40px;\">(1000 + log(log(1000)))\/log(2) = 1445.4<\/p>\n<p>bits in the numerator and<\/p>\n<p style=\"padding-left: 40px;\">1000\/log(2) = 1442.7<\/p>\n<p>bits in the denominator.<\/p>\n<p><strong>Update<\/strong>: See the <a href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/27\/height-of-harmonic-numbers\/\">next post<\/a> for plots as a function of\u00a0<em>n<\/em>.<\/p>\n<h2>Related posts<\/h2>\n<ul>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2017\/04\/18\/computing-harmonic-numbers\/\">Computing harmonic numbers<\/a><\/li>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2021\/01\/23\/sums-of-consecutive-reciprocals\/\">Sums of consecutive reciprocals<\/a><\/li>\n<li class=\"link\"><a href=\"https:\/\/www.johndcook.com\/blog\/2023\/05\/23\/am-over-gm\/\">AM over GM<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The\u00a0nth harmonic number is the sum of the reciprocals of the first\u00a0n positive integers. Hn = 1 + 1\/2 + 1\/3 + 1\/4 + \u2026 + 1\/n The product of all the denominators is\u00a0n!, so you could write Hn as a fraction Hn = p\/q where\u00a0p =\u00a0n! Hn is an integer and q =\u00a0n!. While [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9],"tags":[94],"class_list":["post-247251","post","type-post","status-publish","format-standard","hentry","category-math","tag-number-theory"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"The nth harmonic number can be written as a fraction. How would you predict the number of digits in the numerator and denominator as a function of n?\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"John\"\/>\n\t<meta name=\"keywords\" content=\"number theory\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/26\/writing-down-harmonic-numbers\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"John D. Cook | Applied Mathematics Consulting\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Writing down harmonic numbers\" \/>\n\t\t<meta property=\"og:description\" content=\"The nth harmonic number can be written as a fraction. How would you predict the number of digits in the numerator and denominator as a function of n?\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.johndcook.com\/blog\/2026\/06\/26\/writing-down-harmonic-numbers\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-06-27T01:51:03+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-06-27T12:59:00+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Writing down harmonic numbers\" \/>\n\t\t<meta name=\"twitter:description\" content=\"The nth harmonic number can be written as a fraction. How would you predict the number of digits in the numerator and denominator as a function of n?\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Writing down harmonic numbers","description":"The nth harmonic number can be written as a fraction. How would you predict the number of digits in the numerator and denominator as a function of n?","canonical_url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/26\/writing-down-harmonic-numbers\/","robots":"max-image-preview:large","keywords":"number theory","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"John D. Cook | Applied Mathematics Consulting","og:type":"article","og:title":"Writing down harmonic numbers","og:description":"The nth harmonic number can be written as a fraction. How would you predict the number of digits in the numerator and denominator as a function of n?","og:url":"https:\/\/www.johndcook.com\/blog\/2026\/06\/26\/writing-down-harmonic-numbers\/","article:published_time":"2026-06-27T01:51:03+00:00","article:modified_time":"2026-06-27T12:59:00+00:00","twitter:card":"summary","twitter:title":"Writing down harmonic numbers","twitter:description":"The nth harmonic number can be written as a fraction. How would you predict the number of digits in the numerator and denominator as a function of n?","twitter:image":"https:\/\/www.johndcook.com\/blog\/wp-content\/uploads\/2022\/05\/twittercard.png"},"aioseo_meta_data":{"post_id":"247251","title":null,"description":"The nth harmonic number can be written as a fraction. How would you predict the number of digits in the numerator and denominator as a function of n?","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2026-06-27 00:49:27","updated":"2026-06-27 17:57:48","ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.johndcook.com\/blog\/category\/math\/\" title=\"Math\">Math<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWriting down harmonic numbers\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.johndcook.com\/blog"},{"label":"Math","link":"https:\/\/www.johndcook.com\/blog\/category\/math\/"},{"label":"Writing down harmonic numbers","link":"https:\/\/www.johndcook.com\/blog\/2026\/06\/26\/writing-down-harmonic-numbers\/"}],"_links":{"self":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/comments?post=247251"}],"version-history":[{"count":2,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247251\/revisions"}],"predecessor-version":[{"id":247258,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/posts\/247251\/revisions\/247258"}],"wp:attachment":[{"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/media?parent=247251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/categories?post=247251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.johndcook.com\/blog\/wp-json\/wp\/v2\/tags?post=247251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}]