Monday 22 April 2019

Heptagonal Numbers

Today I turned 25586 days old and, as it turns out, this is a centered heptagonal number given by the formula:$$
\frac{7 n \; (n-1)}{2}+1 \text{  or  } \frac{7n^2-7n+2}{2}
$$
Figure 1: the initial centred heptagonal numbers

The initial centered heptagonal numbers are given by OEIS A069099 (note that these numbers alternate parity in the pattern odd-even-even-odd):

1, 8, 22, 43, 71, 106, 148, 197, 253, 316, 38 , 463, 547, 638, 736, 841, 953, 1072, 1198, 1331, 1471, 1618, 1772, 1933, 2101, 2276, 2458, 2647, 2843, 3046, 3256, 3473, 3697, 3928, 4166, 4411, 4663, 4922, 5188, 5461, 5741, 6028, 6322, 6623, 6931, 7246, 7568, 7897, 8233, 8576, 8926, 9283, 9647, 10018, 10396, 10781, 11173, 11572, 11978, 12391, 12811, 13238, 13672, 14113, 14561, 15016, 15478, 15947, 16423, 16906, 17396, 17893, 18397, 18908, 19426, 19951, 20483, 21022, 21568, 22121, 22681, 23248, 23822, 24403, 24991, 25586

Numbers Aplenty provides a couple of interesting formulae but nothing concerning how they were derived. The formulae are:$$\sum_{n=1}^\infty \frac{1}{H_n}=\frac{2 \pi \tanh \big ( \frac{\pi}{2\sqrt 7} \big )}{\sqrt 7} \text{  and  } \sum_{n=1}^\infty \frac{H_n}{2^n}=15$$Both are fine-looking formulae where \( \tanh \) is the hyperbolic tangent function defined as:$$ \tanh \theta = \frac{\sinh \theta}{\cosh \theta}=\frac{e^{\theta}-e^{-\theta}}{e^{\theta}+e^{- \theta}}=\frac{e^{2 \theta}-1}{e^{2 \theta}+1}$$A centered heptagonal prime is a centered heptagonal number that is prime. These primes form OEIS A144974 and the initial members of this sequence are:

43, 71, 197, 463, 547, 953, 1471, 1933, 2647, 2843, 3697, 4663, 5741, 8233, 9283, 10781, 11173, 12391, 14561, 18397, 20483, 29303, 29947, 34651, 37493, 41203, 46691, 50821, 54251, 56897, 57793, 65213, 68111, 72073, 76147, 84631, 89041

OEIS A144975 also lists a sequence of centered heptagonal twin prime numbers. Each member of this sequence is associated with its twin e.g. 43 is associated with 41 and 71 is associated with 73 etc. and the initial members of this sequence are:

43, 71, 197, 463, 1933, 5741, 8233, 9283, 11173, 14561, 34651, 41203, 57793, 68111, 84631, 104147, 139301, 168631, 207523, 244861, 307693, 333103, 357281, 415381, 465011, 475273, 506731, 592663, 595547, 607153, 729373, 742211, 781397, 876751

So far I've only focused on centered heptagonal numbers but another category of figurate numbers is the heptagonal numbers defined by the formula:$$\frac{5n^2-3n}{2}$$These numbers comprise OEIS A000566 and the initial members are:

0, 1, 7, 18, 34, 55, 81, 112, 148, 189, 235, 286, 342, 403, 469, 540, 616, 697, 783, 874, 970, 1071, 1177, 1288, 1404, 1525, 1651, 1782, 1918, 2059, 2205, 2356, 2512, 2673, 2839, 3010, 3186, 3367, 3553, 3744, 3940, 4141, 4347, 4558, 4774, 4995, 5221, 5452, 5688 

The parity of heptagonal numbers follows the pattern odd-odd-even-even. Like square numbers, the digital root in base 10 of a heptagonal number can only be 1, 4, 7 or 9. Five times a heptagonal number, plus 1 equals a triangular number.

There is an impressive formula for the sum of the reciprocals of the heptagonal numbers:$$\sum_{n=1}^\infty \frac{2}{n(5n-3)} = \frac{1}{15}{\pi}{\sqrt{25-10\sqrt{5}}}+\frac{2}{3}\ln(5)+\frac{{1}+\sqrt{5}}{3}\ln\left(\frac{1}{2}\sqrt{10-2\sqrt{5}}\right)+\frac{{1}-\sqrt{5}}{3}\ln\left(\frac{1}{2}\sqrt{10+2\sqrt{5}}\right)$$This formula and other related formulae are derived in a June 2008 paper titled Beyond the Basel Problem: Sums of Reciprocals of Figurate Numbers. The paper is not for the faint-hearted. Another paper that I stumbled upon when investigating heptagonal numbers was titled Heptagonal Numbers in the Lucas Sequence and Diophantine Equations \(x^2(5x -  3)^2 = 20y^2  \pm 16\). This paper doesn't look as formidable.

However, an article titled Project Euler 61: Find the sum of the only set of six 4-digit figurate numbers with a cyclic property on this site proved to be of the most interest. The article begins:
For some reason Problem 61 of Project Euler is a problem that not so many people have solved compared to the problems in the sixties range.  However, I think that it was a quite approachable problem which was fun to solve.  The problem reads: 
Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae: 
Triangle: \(P_{3,n}=n(n+1)/2 \) with initial members 1, 3, 6, 10, 15, …
Square: \(P_{4,n}=n^2\) with initial members 1, 4, 9, 16, 25, …
Pentagonal: \(P_{5,n}=n(3n-1)/2 \) with initial members 1, 5, 12, 22, 35, …
Hexagonal: \(P_{6,n}=n(2n-1) \) with initial members 1, 6, 15, 28, 45, …
Heptagonal: \(P_{7,n}=n(5n-3)/2 \) with initial members 1, 7, 18, 34, 55, …
Octagonal: \(P_{8,n}=n(3n-2)  \) with initial members 1, 8, 21, 40, 65, … 
The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties: 
1. The set is cyclic, in that the last two digits of each number is the first two digits of the next number (including the last number with the first). 
2. Each polygonal type: triangle (\(P_{3,127}=8128 \)), square (\(P_{4,91}=8281)\), and pentagonal (\(P_{5,44}=2882 \)), is represented by a different number in the set. 
3. This is the only set of 4-digit numbers with this property. 
Find the sum of the only ordered set of six cyclic 4-digit numbers for which each polygonal type: triangle, square, pentagonal, hexagonal, heptagonal, and octagonal, is represented by a different number in the set.
The author of the article provides the code he used to solve this problem. As he said, he used a brute force approach as I probably would if I were attempting it in SageMath (which I haven't tried as yet). Anyway, to cut to the chase, the six cyclic 4-digit numbers are:

1281, 8128, 2882, 8256, 5625, 2512

2512 is the heptagonal number, 1281 is octagonal, 8128 is hexagonal, 2882 is pentagonal, 8256 is triangular and 5625 is a square number (and also a centered octagonal number). 

This article got me curious about Project Euler so I decided to investigate further. Here is what I found:
About Project Euler
Leonhard Euler (1707-1783)
 
What is Project Euler? 
Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems. 
The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.

Who are the problems aimed at?
 
The intended audience include students for whom the basic curriculum is not feeding their hunger to learn, adults whose background was not primarily mathematics but had an interest in things mathematical, and professionals who want to keep their problem solving and mathematics on the cutting edge.

Can anyone solve the problems?
 
The problems range in difficulty and for many the experience is inductive chain learning. That is, by solving one problem it will expose you to a new concept that allows you to undertake a previously inaccessible problem. So the determined participant will slowly but surely work his/her way through every problem.

What next?
 
In order to track your progress it is necessary to setup an account and have Cookies enabled. If you already have an account then Login, otherwise please Register – it's completely free! 
However, as the problems are challenging then you may wish to view the Problems before registering.
There are currently 656 problems listed and I thought it would be interesting to try to solve some of them using SageMath, so I signed up to the site. The first problem I tried was a very simple one but hey, it's a start. Here was the problem:
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... 
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
The answer turns out to be 4613732 and here is the SageMath code that I used to arrive at the solution:
n=0
sum=0
while fibonacci(n)<4000000:
    if fibonacci(n) % 2==0:
        sum+=fibonacci(n)
    n=n+1
print sum
Figure 2: feedback from Project Euler
You might think it's cheating to use the fibonacci function in SageMath but it's easy enough to generate the Fibonacci sequence without resorting to it. However, it's available so I used it. Figure 2 shows the feedback I received from Project Euler. I'm encouraged to try to solve some of the other 655 problems remaining, hopefully with a higher difficulty rating.

No comments:

Post a Comment