BrainDen.com - Brain Teasers

## Question

I'm finding this interesting conjecture, maybe I'm not the first to state this conjecture.
I have tested this conjecture to 100.000 first positive integer.
anybody can provide the prove or disprove this conjecture ?

the conjectre is :
Every positive integer can be written as additon of 1 triangle number, 1 square number, and 1 pentagonal number

note :

Triangle numbers are generated by the formula, tn = ½n(n+1).
The first ten Triangle numbers are:
0, 1, 3, 6, 10, 15, 21, 28, 36, 45, ...

Square numbers are generated by the formula, Sn=n*n.
The first tenSquare numbers are:
0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100,...

Pentagonal numbers are generated by the formula, Pn=n(3n-1)/2.
The first ten pentagonal numbers are:
0, 1, 5, 12, 22, 35, 51, 70, 92, 117,...

100 first positive integer which follow the conjecture :

Spoiler

Numbers    =     Triangle + Square + Pentagon
1    =    0    +    0    +    1
2    =    0    +    1    +    1
3    =    1    +    1    +    1
4    =    0    +    4    +    0
5    =    0    +    0    +    5
6    =    0    +    1    +    5
7    =    1    +    1    +    5
8    =    3    +    0    +    5
9    =    0    +    4    +    5
10    =    0    +    9    +    1
11    =    1    +    9    +    1
12    =    0    +    0    +    12
13    =    0    +    1    +    12
14    =    0    +    9    +    5
15    =    1    +    9    +    5
16    =    0    +    4    +    12
17    =    0    +    16    +    1
18    =    1    +    16    +    1
19    =    3    +    4    +    12
20    =    3    +    16    +    1
21    =    0    +    9    +    12
22    =    0    +    0    +    22
23    =    0    +    1    +    22
24    =    1    +    1    +    22
25    =    0    +    25    +    0
26    =    0    +    4    +    22
27    =    1    +    4    +    22
28    =    0    +    16    +    12
29    =    1    +    16    +    12
30    =    0    +    25    +    5
31    =    0    +    9    +    22
32    =    1    +    9    +    22
33    =    3    +    25    +    5
34    =    3    +    9    +    22
35    =    0    +    0    +    35
36    =    0    +    1    +    35
37    =    0    +    25    +    12
38    =    0    +    16    +    22
39    =    0    +    4    +    35
40    =    1    +    4    +    35
41    =    0    +    36    +    5
42    =    1    +    36    +    5
43    =    6    +    25    +    12
44    =    0    +    9    +    35
45    =    1    +    9    +    35
46    =    10    +    1    +    35
47    =    0    +    25    +    22
48    =    0    +    36    +    12
49    =    0    +    49    +    0
50    =    0    +    49    +    1
51    =    0    +    0    +    51
52    =    0    +    1    +    51
53    =    1    +    1    +    51
54    =    0    +    49    +    5
55    =    0    +    4    +    51
56    =    1    +    4    +    51
57    =    3    +    49    +    5
58    =    0    +    36    +    22
59    =    1    +    36    +    22
60    =    0    +    9    +    51
61    =    0    +    49    +    12
62    =    1    +    49    +    12
63    =    3    +    9    +    51
64    =    0    +    64    +    0
65    =    0    +    64    +    1
66    =    1    +    64    +    1
67    =    0    +    16    +    51
68    =    1    +    16    +    51
69    =    0    +    64    +    5
70    =    0    +    0    +    70
71    =    0    +    1    +    70
72    =    1    +    1    +    70
73    =    3    +    0    +    70
74    =    0    +    4    +    70
75    =    1    +    4    +    70
76    =    0    +    25    +    51
77    =    1    +    25    +    51
78    =    28    +    49    +    1
79    =    0    +    9    +    70
80    =    1    +    9    +    70
81    =    0    +    81    +    0
82    =    0    +    81    +    1
83    =    1    +    81    +    1
84    =    0    +    49    +    35
85    =    1    +    49    +    35
86    =    0    +    16    +    70
87    =    0    +    36    +    51
88    =    1    +    36    +    51
89    =    3    +    16    +    70
90    =    3    +    36    +    51
91    =    10    +    81    +    0
92    =    0    +    0    +    92
93    =    0    +    1    +    92
94    =    1    +    1    +    92
95    =    0    +    25    +    70
96    =    0    +    4    +    92
97    =    1    +    4    +    92
98    =    3    +    25    +    70
99    =    0    +    64    +    35
100    =    0    +    49    +    51

Edited by jasen

## Recommended Posts

• 1
Spoiler

I believe you can represent any positive integer as at least one of t(a) + S(b) + P(c) (allowing a, b, or c to be zero)

I wrote a script to sweep a,b, and c from 0 to some target value each, and record the resulting integers.

For each resulting integer, we count the number of (a,b,c) representations associated with that value.

As long as the number of representations is non-zero for all positive integers, then every integer is expressible by this form.

I plotted the number of representations as a function of resulting integer for sweep targets of 100, 200, and 400.

The third plot is the set of points where the 200 run matches the 400 run, which should be truth (i.e. the same as if we went to infinity).

The max and min envelope of this "truth" plot look roughly logarithmic. I would be very surprised if any positive integer drops to zero.

Therefore I think all positive integers have at least one representation and your conjecture is correct.

Spoiler

def fa(a):
return int(0.5*a*(a+1));
def fb(b):
return int(b**2);
def fc(c):
return int(0.5*c*(3*c-1));
def f(a,b,c):
return fa(a) + fb(b) + fc(c);

target = 100;
seen = {};
for a in range(target):
for b in range(target):
for c in range(target):
z = f(a,b,c);
if not z in seen:
#seen[z] = []
seen[z] = 0;
#seen[z].append((a,b,c))
seen[z] += 1;

#seen = list(sorted(seen));
for i in range(int(max(seen))):
if not i in seen:
print i;
break;
out = [];
for z in sorted(seen):
out.append((z,seen[z]))
with open('out_%d.csv' % target,'wb') as f:
f.write('\r\n'.join('%d,%d' % r for r in out));

Edited by mmiguel

##### Share on other sites
• 1

I'm not sure how to even approach this analytically. But I was able to get some C code working very efficiently, and found that every number up to at least a billion can be represented by the sum of a triangular, square, and pentagonal number. This algorithm starts of with the pentagonal number as large as it can be without exceeding the target value and gradually decreases the pentagonal number if there are no combination of a triangle and square with it that can hit the target value, so finding a solution with a large pentagonal number is suggestive that there are many solutions for that target value. And when you get in the range of these large numbers, the pentagonal number is much greater than the triangular or square number.

Output for some of the larger numbers (The algorithm only prints out solutions at every 1,000,000 values so it doesn't lose efficiency simply from printing out all the results, but it calculates a solution for every value, and would stop if it hits a value with no solution.)

Spoiler

Value 986000000 = tri(622) + sq(111) + pent(25636)
Value 987000000 = tri(322) + sq(11) + pent(25651)
Value 988000000 = tri(137) + sq(345) + pent(25663)
Value 989000000 = tri(238) + sq(148) + pent(25677)
Value 990000000 = tri(115) + sq(205) + pent(25690)
Value 991000000 = tri(600) + sq(143) + pent(25701)
Value 992000000 = tri(791) + sq(198) + pent(25712)
Value 993000000 = tri(37) + sq(200) + pent(25729)
Value 994000000 = tri(271) + sq(13) + pent(25742)
Value 995000000 = tri(437) + sq(120) + pent(25754)
Value 996000000 = tri(1050) + sq(132) + pent(25761)
Value 997000000 = tri(184) + sq(77) + pent(25781)
Value 998000000 = tri(586) + sq(3) + pent(25792)
Value 999000000 = tri(148) + sq(2) + pent(25807)

C code

Spoiler

```
#include <stdio.h>

void main() {
long value, t, s, p;
long max_p = 0;
long p_value, ps_value;
int found;

for (value=1; value<1000000000; value++) {
found = 0;
while ((max_p*(3*max_p-1)/2) <= value) {max_p++;}

for (p = max_p-1; p>-1 && found==0; p--) {
p_value = p*(3*p-1)/2;
for (t=0; p_value + t*(t+1)/2 < value; t++) {}
for (s=0; ((ps_value = p_value + s*s) <= value) && (found==0); s++) {
while (ps_value + t*(t+1)/2 > value) {t--;}
if (ps_value + t*(t+1)/2 == value) {
found = 1;
if (value % 1000000 == 0) {
printf("Value %d = tri(%d) + sq(%d) + pent(%d)\n", value, t, s, p);
}
}
}
}

if (found==0) {
printf("Could not find value %d\n", value);
return;
}
}
}```

Edited by plasmid
Fixed code formatting

##### Share on other sites
• 0

Thanks Plasmid for your attempt to test this conjecture effectively to 1 trillion.

There is a way to check whether a number is pentagonal, square or triangle, by find out the n-th of the number.

n-th Pentagon x = (1+sqrt(1+24* x)) / 6,  (if n is integer so the number is pentagonal)
n-th Square x = sqrt x,                            (if n is integer so the number is square number)
n-th Triangle x = (sqrt(8*x + 1)-1)/2,         (if n is integer so the number is triangle)

Edited by jasen

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account. ×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×