Page 1 of 2
Problem 061
Posted: Mon Mar 31, 2008 2:34 pm
by Josay
Hello everybody,
I've got troubles with the problem 61.
(Link to problem added by moderator:
Problem 61 (
View Problem))
The wording is :
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.
I found this solution : n1=1 n2=148 n3=4851 n4=5151 n5=5184 n6=8400
First point is each polygonal type is represented by a different number :
Code: Select all
n1=1 n2=148 n3=4851 n4=5151 n5=5184 n6=8400
tri 1 0 *1* 1 0 0
squ 1 0 0 0 *1* 0
pen 1 0 0 0 0 *1*
hex 1 0 0 *1* 0 0
hep 1 *1* 0 0 0 0
oct *1* 0 0 0 0 0
tri squ pen hex hep oct
n1: 1 1 1 1 1 1 *1*
n2: 148 0 0 0 0 *1* 0
n3:4851*1* 0 0 0 0 0
n4:5151 1 0 0 *1* 0 0
n5:5184 0 *1* 0 0 0 0
n6:8400 0 0 *1* 0 0 0
s:23735
Second point is this solution is cyclic and composed by 6 4-digits numbers:
Code: Select all
0001
148
4851
5151
5184
8400
0001 and so on
I still don't see why my solution is not good. So iif someone could help me telling me what part of the problem I could have misunderstood.
Thanks.
(Sorry for my poor English)
Re: Problem with the problem 61
Posted: Mon Mar 31, 2008 2:41 pm
by Tommy137
We always write numbers without leading zeros.
Re: Problem with the problem 61
Posted: Mon Mar 31, 2008 2:50 pm
by Josay
Ok, that is a good reason.
Thanks a lot.
Edit : Well, in fact I discovered the true solution. I was searching n1<n2<n3<n4<n5<n6 and finally, it was not the case.
Could anybody explain me what "Find the sum of the only ordered set of six cyclic 4-digit numbers for which each polygonal type" means?
Re: Problem 061
Posted: Mon Aug 31, 2009 3:30 pm
by MaJJ
Hi there,
I've got troubles with this one. Everything looks fine, my code outputs (!) two answers, but they are wrong.
Code: Select all
4465 + 6561 + 6112 + 1225 + 2512 + 1281
22156
5565 + 6561 + 6112 + 1225 + 2512 + 1281
23256
What's wrong?
Thanks in advance

Re: Problem 061
Posted: Mon Aug 31, 2009 3:34 pm
by Tommy137
MaJJ wrote:Hi there,
I've got troubles with this one. Everything looks fine, my code outputs (!) two answers, but they are wrong.
Code: Select all
4465 + 6561 + 6112 + 1225 + 2512 + 1281
22156
5565 + 6561 + 6112 + 1225 + 2512 + 1281
23256
What's wrong?
Thanks in advance

"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). "
So, if your last number is 1281, the first number should be 81..
Re: Problem 061
Posted: Mon Aug 31, 2009 3:55 pm
by MaJJ
Aha, I somehow skipped that sentence

Thanks.
Edit: Heh, now my code can't find any such set

I guess my conditions are too strict...
Re: Problem 061
Posted: Sun Sep 13, 2009 12:09 pm
by estanford
Quick question about this problem -- how is it possible that each of the six numbers separately represent a triangular, square, pentagonal, hexagonal, heptagonal and octagonal number when all hexagonal numbers are triangular?
Re: Problem 061
Posted: Sun Sep 13, 2009 7:41 pm
by rayfil
when all hexagonal numbers are triangular?
But, not all triangular numbers are hexagonal.
Re: Problem 061
Posted: Sun Oct 03, 2010 4:41 pm
by klang
Strangely, using this (wrong) definition of heptagonals ALSO produce a unique reply .. the wrong one of course
Code: Select all
(def heptagonals
(map (fn [n] (quot (* n (- (* 5 n) 1)) 3)) (iterate inc 1)))
Re: Problem 061
Posted: Mon Jan 17, 2011 3:32 pm
by iordan_tanev
Hi,
i have a simple problem and i cant find the problem in my code. When i run the algorithm without the check that triangle number is not Hexagonal i get 6 sets. One of these sets is:
The problem is that 8128 is Triangle and Hexagonal. But when i add in my algorithm check to exclude sets with numbers both Triangle and Hexagonal i get zero results. Is this check not needed or am i missing something else.
Best Regards,
Iordan
Re: Problem 061
Posted: Mon Jan 17, 2011 5:04 pm
by Mr.Wizard
The check is not needed. Now, remove your output, please.
Re: Problem 061
Posted: Mon Jan 17, 2011 7:35 pm
by iordan_tanev
Hi,
thanks a lot for the quick answer. Your help is greatly appreciateа
Best Regards,
Iordan
Re: Problem 061
Posted: Sat Jan 22, 2011 2:35 pm
by ReNegr
Hi,
I'm having a little trouble with the wording of this one.
I get the cyclic part but what they mean by ordered set?
Is it this? n1>=n2>=n3>=n4>=n5>=n6 ?
Best Regards,
Renato
Re: Problem 061
Posted: Sat Jan 22, 2011 2:43 pm
by Lord_Farin
ReNegr wrote:Hi,
I'm having a little trouble with the wording of this one.
I get the cyclic part but what they mean by ordered set?
Is it this? n1>=n2>=n3>=n4>=n5>=n6 ?
Best Regards,
Renato
No, it means only that your set comes with a given order. That is, it is given which number is on which place in your list.
An example: As unordered sets, {2,3} and {3,2} are equal, but as ordered sets, they are not.
Re: Problem 061
Posted: Sat Jan 22, 2011 2:49 pm
by ReNegr
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
This means that the first number has to be a triangle, the second a square and so on ?
Best Regards,
Renato
Re: Problem 061
Posted: Sat Jan 22, 2011 7:33 pm
by TripleM
No, it doesn't say they have to be in that order. In fact, they're not in order in the previous example either - 8281 was the square number.
Re: Problem 061
Posted: Mon May 09, 2011 5:24 pm
by chiefsci
I've written a program in C++ that should tell me the answer. Unfortunately, I've written it with a segment that has 12 nested "for" loops, and while the inner 6 loops are n=0 to 5, the outer loops are n=0 to 96. From my calculations, this will take over 490 days to run.
Can anybody give me an idea of how to make this program more efficient? There must be a way to solve this without comparing each and every possible combination of triangular numbers, square numbers, pentagonal numbers, hexagonal numbers, heptagonal numbers, and octagonal numbers, but I seem to be missing it.
Re: Problem 061
Posted: Mon May 09, 2011 6:15 pm
by rayfil
There must be a way to solve this without ....
Yes there is, almost instantaneous.

Re: Problem 061
Posted: Mon May 09, 2011 6:40 pm
by chiefsci
And I'm guessing it has nothing to do with storing the values in a 2D array...
Re: Problem 061
Posted: Mon May 09, 2011 8:21 pm
by thundre
klang wrote:Strangely, using this (wrong) definition of heptagonals ALSO produce a unique reply .. the wrong one of course
Code: Select all
(def heptagonals
(map (fn [n] (quot (* n (- (* 5 n) 1)) 3)) (iterate inc 1)))
Weird, I made exactly the same mistake, dropped the /2 from the formula for heptagonal. The /2 is right there in the problem text, which I always save before starting. I re-checked them all after seeing your comment, and sure enough, I had the same mistake in the same formula, except mine was in Java.