CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2011
    Posts
    1

    Food for thought for Algorithm

    Hello everyone,

    i am new and hopefully right here. Excuse my english, because it is not the best
    So.. i have to solve the following problem and no idea where i should start. So i am searching
    for an "Food for thought" . Now to the problem:

    Imagine a triangle made of numbers (with edge lenght n) . For Example:

    1
    2 3
    4 5 6

    (Edge lenght: n=3)

    The task is to develop an algorithm, that generates an triangle with an minimum of different numbers and (now the hard part) without any inner equilateral triangles, havin the same numbers as edges (one number of these edges must be different !). Those inner triangles can have different edge lenghtes, but have to be equilaterally.

    In the attached Images "triangle.png"(n=3) and "triangle2.png"(n=4) are examples for invalid triangles. The inner triangles, which are not valid have red edges.

    In "triangle3.png"(n=7) is an example for a valid triangle.


    I found out that every number in the hole triangle is an edge for (n-1) inner triangles and that the total number of inner triangles (T) can be calculated as follows:




    So maybe someone has an idea for such an algorithm, because im out of ideas...
    The hard thing is, to generate an trinagle with a minimum of different numbers (it would be easy without this condition )

    Thank you very much


    PS: If you have more questions, please ask me.
    Attached Images Attached Images

  2. #2
    Join Date
    Jun 2010
    Posts
    50

    Re: Food for thought for Algorithm

    Time flies by, now I still find the problems of triangles more interesting. How come have they inspired me that much ? I don't know, maybe academics I am interested in. Does your problem have a name or is it an excelent trick a magician just make up somewhere ? I would like to study it more in details. Thank you.
    Last edited by TheComputer; February 8th, 2011 at 07:19 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured