Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Cannonballs
Views: 74
Visibility: Unlisted (only visible to those who know the link)
Kernel: Python 3 (Ubuntu Linux)
Cannonball Numbers{\Huge \text{Cannonball Numbers}}

An nn-gon number is a type of figurate number that is a generalization of triangular, square, etc., to an nn-gon for n an arbitrary positive integer. The mmth nn-gon numbers is the number of cannonballs that can be arranged to form a filled in regular nn-gon of side length mm. For example, the first few hexagon numbers are 1,6,15,281,6,15,28, and 4545.

The mmth nn-gon pyramidal number is the sum of the first mm nn-gon numbers and correspond to the number of cannonballs needed to construct a solid pyramid with mm filled-in nn-gon layers. For example, the first few hexagon pyramidal numbers are 1,7,22,50,951,7,22,50,95, and 161161.

We want to ask: For a given nn, what number of cannonballs can be arranged in a solid nn-gon based pyramid and rearranged to make a flat, filled-in nn-gon? Equivalently, which nn-gon numbers are also nn-gon pyramidal numbers?

This (when n=4n=4) is commonly known as the Cannonball Problem. If a number satisfies this condition, it is known as a cannonball number.

For more information: http://mathworld.wolfram.com/CannonballProblem.html, https://www.youtube.com/watch?v=q6L06pyt9CA, http://mathworld.wolfram.com/PyramidalNumber.html, http://mathworld.wolfram.com/PolygonalNumber.html

Below, we will investigat this idea for n=5n=5 and n=6n=6 and extend the cannonball number to n4n\neq 4.

E = EllipticCurve([1,12,4,1]) print(E) E.integral_points() # [(1 : 2 : 1)] # E.S_integral_points([2]) # [(-103/64 : -233/512 : 1), (1 : 2 : 1)]

Existance of Cannonball Numbers\Large \text{Existance of Cannonball Numbers}

Recall that the mmth nn-gon number is given by Nn(m)=m[(m1)n2(m2)]2,N^{(m)}_n=\frac{m[(m-1)n-2(m-2)]}{2}, and the mmth nn-gon pyramidal number is given by Pn(m)=m(m+1)[(n2)m+(5n)]6.P^{(m)}_n=\frac{m(m+1)[(n-2)m+(5-n)]}{6}.

A number cc is an nn-gon cannonball number if and only if it is the aath nn-gon number and the bbth nn-gon pyramidal number, for some integers aa and bb, greater than 1. Equivalently,

a[(a1)n2(a2)]2=Nn(a)=c=Pn(b)=b(b+1)[(n2)b+(5n)]6\frac{a[(a-1)n-2(a-2)]}{2}=N_n^{(a)}=c=P_n^{(b)}=\frac{b(b+1)[(n-2)b+(5-n)]}{6}\Updownarrow3a[(a1)n2(a2)]=b(b+1)[(n2)b+(5n)]3a[(a-1)n-2(a-2)]=b(b+1)[(n-2)b+(5-n)]

must have a solution (a,b)(a,b), with a,bN{1}a,b\in\mathbb{N}\setminus\{1\}.

Diophantine Equations\large \text{Diophantine Equations}

For each of the following equations, for each solution (a,b)(a,b), with a,bN{1}a,b\in\mathbb{N}\setminus\{1\}, there exists a cannonball number c=Nn(a)=Pn(b)c=N^{(a)}_n=P^{(b)}_n.

For n=3n=3: 3a2+3a=b3+3b2+2b3a^2+3a= b^3+3b^2 +2b For n=4n=4: 6a2=2b3+3b2+b6a^2=2b^3+3b^2+b For n=5n=5: 3a2a=b3+b23a^2-a=b^3+b^2 For n=6n=6: 12a26a=4b3+3b2b12a^2-6a=4b^3+3b^2-b For n=7n=7: 15a29a=5b3+3b22b15a^2-9a=5b^3+3b^2-2b

There is no Cannonball Number for n=5.\large \text{There is no Cannonball Number for } n=5.

If there exists a pentagon cannonball number, 1<cN1 < c\in\mathbb{N}. Then there would exist a,bNa,b\in\mathbb{N} for which the aath pentagon number is the bbth pentagon pyramidal number. Equivalently, there must exist an a,bN{1}a,b\in\mathbb{N}\setminus\{1\} for which. a(3a1)2=c=b2(b+1)2,\frac{a(3a-1)}{2}=c=\frac{b^2(b+1)}{2},     3a2a=b3+b2,\iff 3a^2-a=b^3+b^2,     a213a=13b3+13b2,\iff a^2-\frac{1}{3}a=\frac{1}{3}b^3+\frac{1}{3}b^2,     (a16)2=136+13b3+13b2,\iff \left(a-\frac{1}{6}\right)^2=\frac{1}{36}+\frac{1}{3}b^3+\frac{1}{3}b^2,     36(a16)2=1+12b3+12b2,\iff 36\left(a-\frac{1}{6}\right)^2=1+12b^3+12b^2,     (6a1)2=1+12b3+12b2,\iff \left(6a-1\right)^2=1+12b^3+12b^2,     y2=1+12b3+12b2.\iff y^2=1+12b^3+12b^2.

Python Investigation{\Large \text{Python Investigation}}

Using the quadradic formula for Nn(m)=m[(m1)n2(m2)]2N_n^{(m)}=\frac{m[(m-1)n-2(m-2)]}{2} to solve for mm, we have that rr is an nn-gon number if and only if n42±(4n2)2+2r(n2)n2\frac{\frac{n-4}{2}\pm\sqrt{\left(\frac{4-n}{2}\right)^2+2r\left(n-2\right)}}{n-2} is a positive integer. I use this fact for the isPN function.

import numpy as np from numba import njit
def N(m,n): # returns the mth n-gon number return m*((m-1)*n-2*(m-2))//2 # integer division is ok def PN(m,n): # returns the mth n-gon pyramidal number if n < 3: return -1 else: return (m*(m+1)*((n-2)*m+(5-n)))//6 # integer division is ok def isN(r,n): # verifies if r is a n-gon number i = (((n-4)/(2))+np.sqrt(((4-n)/(2))**2+2*r*(n-2)))/(n-2) j = (((n-4)/(2))-np.sqrt(((4-n)/(2))**2+2*r*(n-2)))/(n-2) if (i % 1 == 0) and i > 0: return (True, int(i)) if (j % 1 == 0) and j > 0: return (True, int(j)) return (False, -1) def isPN(r,n): # verifies if r is a n-gon pyramidal number bool = False i = 1 while (bool == False) and i <= r: if PN(i,n) == r: return (True, i) i = i + 1 return (False, -1) def check_for_cannonballs(lowerbound, upperbound, n, breakIfFound): for i in range(lowerbound,upperbound+1): test = isN(PN(i,n),n) if test[0] and (N(test[1],n)==PN(i,n)): # the second condition is a dummy check to make sure there are no rounding errors print(f'{PN(i,n)} is an {n}-gon cannonball number: {PN(i,n)} is the {test[1]} {n}-gon number and the {i} {n}-gon pyramidal number.') if breakIfFound == True: break if breakIfFound == False: print(f'No others found.')
check_for_cannonballs(2,100,3,False)
10 is an 3-gon cannonball number: 10 is the 4 3-gon number and the 3 3-gon pyramidal number. 120 is an 3-gon cannonball number: 120 is the 15 3-gon number and the 8 3-gon pyramidal number. 1540 is an 3-gon cannonball number: 1540 is the 55 3-gon number and the 20 3-gon pyramidal number. 7140 is an 3-gon cannonball number: 7140 is the 119 3-gon number and the 34 3-gon pyramidal number. No others found.