The Project Euler thread

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dag12
    FFR Simfile Author
    FFR Simfile Author
    • Dec 2004
    • 468

    #31
    Re: THE project euler thread

    Sounds like you could just write a script for euler's totient function and then run a for loop or something >.>
    Though I'm sure there's a more elegant way of doing it.

    Also, any way to check answers without registering?

    Comment

    • Reincarnate
      x'); DROP TABLE FFR;--
      • Nov 2010
      • 6332

      #32
      Re: THE project euler thread

      Originally posted by dag12
      Sounds like you could just write a script for euler's totient function and then run a for loop or something >.>
      Though I'm sure there's a more elegant way of doing it.

      Also, any way to check answers without registering?
      tried this :<

      and no you have to register

      Comment

      • stargroup100
        behanjc & me are <3'ers
        FFR Simfile Author
        FFR Music Producer
        • Jul 2006
        • 2051

        #33
        Re: THE project euler thread

        UGH

        okay this problem is seriously impossible tackling it the way I'm doing it unless there's some beautiful optimization trick

        this is not working
        Rhythm Simulation Guide
        Comments, criticism, suggestions, contributions, etc. are all welcome.

        Piano Etude Demon Fire sheet music

        Comment

        • Reincarnate
          x'); DROP TABLE FFR;--
          • Nov 2010
          • 6332

          #34
          Re: THE project euler thread

          getting close but still off

          the way I am tackling it is actually very similar to what you posed above (raising primes to powers) but figuring out where to fix things is tricky

          For Co(10):
          sorted mainlist [1, 5, 7, 8, 9]
          sum of mainlist 30
          primes [3, 5, 7]

          this is fine

          For Co(30):
          sorted mainlist [1, 11, 13, 17, 19, 23, 25, 27, 28, 29]
          sum of mainlist 193
          primes [3, 5, 7, 11, 13, 17, 19, 23, 29]

          this is correct too

          But for Co(100):
          sorted mainlist [1, 11, 13, 17, 19, 23, 25, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 81, 83, 89, 97, 98]
          sum of mainlist 1248
          primes [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

          this is incorrect
          Last edited by Reincarnate; 10-23-2011, 02:31 PM.

          Comment

          • iironiic
            D6 FFR Legacy Player
            FFR Simfile Author
            • Jan 2009
            • 4342

            #35
            Re: THE project euler thread

            Should 99 be in your sorted mainlist for Co(100)?

            I'm thinking about an approach right now, but I haven't come up with anything yet.

            Comment

            • Reincarnate
              x'); DROP TABLE FFR;--
              • Nov 2010
              • 6332

              #36
              Re: THE project euler thread

              Originally posted by iironiic
              Should 99 be in your sorted mainlist for Co(100)?

              I'm thinking about an approach right now, but I haven't come up with anything yet.

              sorted mainlist [1, 7, 11, 13, 16, 17, 19, 23, 25, 27, 29]
              sum of mainlist 188
              primes [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]

              This is what I get for Co(30) without that optimization and going for power-raising alone. Obviously I need to toss 28 into this beast, but in doing so I must remove 7 and 16.

              EDIT: What I do now, in general is create the "naive prime-raised" solution and then add numbers to the solution and remove all coprime elements, then check to see if that sum is better than what I had before. If so, update solution. If not, kept what I had before and try a new number.

              Last edited by Reincarnate; 10-23-2011, 04:24 PM.

              Comment

              • Reincarnate
                x'); DROP TABLE FFR;--
                • Nov 2010
                • 6332

                #37
                Re: THE project euler thread

                Hm somehow it's one off, wtf


                sorted mainlist [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 95, 97, 99]
                sum of mainlist 1355
                primes [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

                Comment

                • LongGone
                  -
                  FFR Simfile Author
                  • Jul 2008
                  • 1679

                  #38
                  Re: THE project euler thread

                  Originally posted by stargroup100
                  Problem 355:

                  However, it is possible that a term has the form (p^a)(q^b), where p and q are primes, if (p^a)(q^b) > p^c + q^d. (where a,b,c,d are the highest possible powers such that each term is less than n)
                  Could this be extended to cover cases of (p^a)(q^b)(r^c) > p^d + q^e + r^f etc. ? I can't think of an example though. The huge annoyance here is that the list of numbers are exhaustive, everytime you form a set of p,q there could be another set which may use them more efficiently instead (pointing out the obvious though)
                  My Solo Simfiles
                  My Solo Simfiles Part 2

                  Originally posted by Choofers
                  people age at a rate of about 1 year per year

                  Comment

                  • stargroup100
                    behanjc & me are <3'ers
                    FFR Simfile Author
                    FFR Music Producer
                    • Jul 2006
                    • 2051

                    #39
                    Re: THE project euler thread

                    I have a conjecture that a term of the form (p^a)(q^b)(r^c) is never found in a maximal sum subset, but I'm not sure if I can prove it. If this is true it would at least make the problem significantly easier. I forgot to mention this earlier.
                    Rhythm Simulation Guide
                    Comments, criticism, suggestions, contributions, etc. are all welcome.

                    Piano Etude Demon Fire sheet music

                    Comment

                    • Reincarnate
                      x'); DROP TABLE FFR;--
                      • Nov 2010
                      • 6332

                      #40
                      Re: THE project euler thread

                      can anyone find the problem in my earlier list? should equal 1356, not 1355 (according to the problem description)
                      Last edited by Reincarnate; 10-23-2011, 04:15 PM.

                      Comment

                      • stargroup100
                        behanjc & me are <3'ers
                        FFR Simfile Author
                        FFR Music Producer
                        • Jul 2006
                        • 2051

                        #41
                        Re: THE project euler thread

                        lurker had the same problem

                        I'm trying to find the error as well
                        Rhythm Simulation Guide
                        Comments, criticism, suggestions, contributions, etc. are all welcome.

                        Piano Etude Demon Fire sheet music

                        Comment

                        • LongGone
                          -
                          FFR Simfile Author
                          • Jul 2008
                          • 1679

                          #42
                          Re: THE project euler thread

                          Originally posted by Reincarnate
                          can anyone find the problem in my earlier list? should equal 1356, not 1355 (according to the problem description)

                          Since you are one off from the actual answer (changing from odd to even), it implies that one set of (p^a)(q^b) should be degrouped, or grouped (e.g. 5*19=95(odd), or 5^a+19^b=even). Swapping pairs of number products will not change the odd/even parity
                          The main concern are the primes <10 in this case (because obviously you can't multiply two primes >10 that will result in <100 product)
                          So the usable primes are 2,3,5,7
                          Since you used up all 4 and ended up with 1355; If 1356 was not a mistake, that means that you have to degroup one of those primes and leave one as a natural power of itself (which is counterintuitive)
                          ...So either the 13 people who solved didnt bother checking Co(100), or I'm missing something rofl
                          (or a rare case of a possible product of three primes, which idk if its plausible)

                          For a possible general approach, to try to maximise sum, we can start by getting rid of all the small primes
                          So e.g. for Co(100), start with 11,13,17,19. With your current solution we got: 99 (3,11), 95 (5,19), and 92 (2,23), 91 (7,13). Could there be a possible solution using 17 in place of 23?

                          Last edited by LongGone; 10-23-2011, 05:03 PM.
                          My Solo Simfiles
                          My Solo Simfiles Part 2

                          Originally posted by Choofers
                          people age at a rate of about 1 year per year

                          Comment

                          • stargroup100
                            behanjc & me are <3'ers
                            FFR Simfile Author
                            FFR Music Producer
                            • Jul 2006
                            • 2051

                            #43
                            Re: THE project euler thread

                            edit2: ok I was being stupid

                            EDIT: Rubix, your answer might be wrong but it looks pretty close :D
                            Last edited by stargroup100; 10-23-2011, 08:20 PM.
                            Rhythm Simulation Guide
                            Comments, criticism, suggestions, contributions, etc. are all welcome.

                            Piano Etude Demon Fire sheet music

                            Comment

                            • Reincarnate
                              x'); DROP TABLE FFR;--
                              • Nov 2010
                              • 6332

                              #44
                              Re: THE project euler thread

                              A step-by-step runthrough of the Co(100) process:

                              initial naive list from prime-raising alone: [1, 11, 13, 17, 19, 23, 25, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 64, 67, 71, 73, 79, 81, 83, 89, 97] with sum 1263

                              adding 99 to the list and removing non-coprimes to test [1, 13, 17, 19, 23, 25, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 64, 67, 71, 73, 79, 83, 89, 97, 99]
                              Updating list because biggestsum 1263 is less than 1270
                              adding 98 to the list and removing non-coprimes to test [1, 13, 17, 19, 23, 25, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 98, 99]
                              adding 96 to the list and removing non-coprimes to test [1, 13, 17, 19, 23, 25, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 79, 83, 89, 96, 97]
                              adding 95 to the list and removing non-coprimes to test [1, 13, 17, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 64, 67, 71, 73, 79, 83, 89, 95, 97, 99]
                              Updating list because biggestsum 1270 is less than 1321
                              adding 94 to the list and removing non-coprimes to test [1, 13, 17, 23, 29, 31, 37, 41, 43, 49, 53, 59, 61, 67, 71, 73, 79, 83, 89, 94, 95, 97, 99]
                              adding 93 to the list and removing non-coprimes to test [1, 13, 17, 23, 29, 37, 41, 43, 47, 49, 53, 59, 61, 64, 67, 71, 73, 79, 83, 89, 93, 95, 97]
                              adding 92 to the list and removing non-coprimes to test [1, 13, 17, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 79, 83, 89, 92, 95, 97, 99]
                              Updating list because biggestsum 1321 is less than 1326
                              adding 91 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 95, 97, 99]
                              Updating list because biggestsum 1326 is less than 1355
                              adding 90 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 90, 91, 97]
                              adding 88 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 88, 89, 91, 95, 97]
                              adding 87 to the list and removing non-coprimes to test [1, 17, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 87, 89, 91, 92, 95, 97]
                              adding 86 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 47, 53, 59, 61, 67, 71, 73, 79, 83, 86, 89, 91, 95, 97, 99]
                              adding 85 to the list and removing non-coprimes to test [1, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 85, 89, 91, 92, 97, 99]
                              adding 84 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 84, 89, 95, 97]
                              adding 82 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 43, 47, 53, 59, 61, 67, 71, 73, 79, 82, 83, 89, 91, 95, 97, 99]
                              adding 81 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 81, 83, 89, 91, 92, 95, 97]
                              adding 80 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 80, 83, 89, 91, 97, 99]
                              adding 78 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 78, 79, 83, 89, 95, 97]
                              adding 77 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 77, 79, 83, 89, 92, 95, 97]
                              adding 76 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 76, 79, 83, 89, 91, 97, 99]
                              adding 75 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 75, 79, 83, 89, 91, 92, 97]
                              adding 74 to the list and removing non-coprimes to test [1, 17, 29, 31, 41, 43, 47, 53, 59, 61, 67, 71, 73, 74, 79, 83, 89, 91, 95, 97, 99]
                              adding 72 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 72, 73, 79, 83, 89, 91, 95, 97]
                              adding 70 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 70, 71, 73, 79, 83, 89, 97, 99]
                              adding 69 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 69, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 68 to the list and removing non-coprimes to test [1, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 68, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 66 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 66, 67, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 65 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 65, 67, 71, 73, 79, 83, 89, 92, 97, 99]
                              adding 64 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 64, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 63 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 63, 67, 71, 73, 79, 83, 89, 92, 95, 97]
                              adding 62 to the list and removing non-coprimes to test [1, 17, 29, 37, 41, 43, 47, 53, 59, 61, 62, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 60 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 60, 61, 67, 71, 73, 79, 83, 89, 91, 97]
                              adding 58 to the list and removing non-coprimes to test [1, 17, 31, 37, 41, 43, 47, 53, 58, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 57 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 57, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 97]
                              adding 56 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 56, 59, 61, 67, 71, 73, 79, 83, 89, 95, 97, 99]
                              adding 55 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 55, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 97]
                              adding 54 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 53, 54, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 52 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 52, 53, 59, 61, 67, 71, 73, 79, 83, 89, 95, 97, 99]
                              adding 51 to the list and removing non-coprimes to test [1, 29, 31, 37, 41, 43, 47, 51, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 95, 97]
                              adding 50 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 50, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 97, 99]
                              adding 49 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 79, 83, 89, 92, 95, 97, 99]
                              adding 48 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 47, 48, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 46 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 46, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 45 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 45, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 97]
                              adding 44 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 43, 44, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 42 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 41, 42, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 95, 97]
                              adding 40 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 40, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 97, 99]
                              adding 39 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 39, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 92, 95, 97]
                              adding 38 to the list and removing non-coprimes to test [1, 17, 29, 31, 37, 38, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 97, 99]
                              adding 36 to the list and removing non-coprimes to test [1, 17, 29, 31, 36, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 35 to the list and removing non-coprimes to test [1, 17, 29, 31, 35, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 92, 97, 99]
                              adding 34 to the list and removing non-coprimes to test [1, 29, 31, 34, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 33 to the list and removing non-coprimes to test [1, 17, 29, 31, 33, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 95, 97]
                              adding 32 to the list and removing non-coprimes to test [1, 17, 29, 31, 32, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 30 to the list and removing non-coprimes to test [1, 17, 29, 30, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 97]
                              adding 28 to the list and removing non-coprimes to test [1, 17, 28, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 95, 97, 99]
                              adding 27 to the list and removing non-coprimes to test [1, 17, 27, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 95, 97]
                              adding 26 to the list and removing non-coprimes to test [1, 17, 26, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 95, 97, 99]
                              adding 25 to the list and removing non-coprimes to test [1, 17, 25, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 97, 99]
                              adding 24 to the list and removing non-coprimes to test [1, 17, 24, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 23 to the list and removing non-coprimes to test [1, 17, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 22 to the list and removing non-coprimes to test [1, 17, 22, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 21 to the list and removing non-coprimes to test [1, 17, 21, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 92, 95, 97]
                              adding 20 to the list and removing non-coprimes to test [1, 17, 20, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 97, 99]
                              adding 19 to the list and removing non-coprimes to test [1, 17, 19, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 97, 99]
                              adding 18 to the list and removing non-coprimes to test [1, 17, 18, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 16 to the list and removing non-coprimes to test [1, 16, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 15 to the list and removing non-coprimes to test [1, 15, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 97]
                              adding 14 to the list and removing non-coprimes to test [1, 14, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 95, 97, 99]
                              adding 13 to the list and removing non-coprimes to test [1, 13, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 92, 95, 97, 99]
                              adding 12 to the list and removing non-coprimes to test [1, 12, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 11 to the list and removing non-coprimes to test [1, 11, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 95, 97]
                              adding 10 to the list and removing non-coprimes to test [1, 10, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 97, 99]
                              adding 9 to the list and removing non-coprimes to test [1, 9, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 95, 97]
                              adding 8 to the list and removing non-coprimes to test [1, 8, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 7 to the list and removing non-coprimes to test [1, 7, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 92, 95, 97, 99]
                              adding 6 to the list and removing non-coprimes to test [1, 6, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97]
                              adding 5 to the list and removing non-coprimes to test [1, 5, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 97, 99]
                              adding 4 to the list and removing non-coprimes to test [1, 4, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]
                              adding 3 to the list and removing non-coprimes to test [1, 3, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 95, 97]
                              adding 2 to the list and removing non-coprimes to test [1, 2, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 95, 97, 99]

                              sorted, final mainlist [1, 17, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 91, 92, 95, 97, 99]
                              sum of mainlist 1355
                              Last edited by Reincarnate; 10-23-2011, 05:19 PM.

                              Comment

                              • stargroup100
                                behanjc & me are <3'ers
                                FFR Simfile Author
                                FFR Music Producer
                                • Jul 2006
                                • 2051

                                #45
                                Re: THE project euler thread

                                Your solution is too linear. You should take into consideration the possible case that immediately adding the largest possible number won't optimize the overall total.

                                It's possible there is a different combination of the primes that rounds out to a better sum. I recommend this method:

                                - Separate primes into 3 categories: between 2 and sqrt(n), between sqrt(n) and n/2, and the others
                                - Add up all of the primes in the last category. These don't change.
                                - The terms in the second category have the most room for possible optimizations, and therefore should try to be optimized first. They obviously cannot be paired with a prime from its own category, so pair it with a prime from the first category. Try every combination here.
                                - The last possible case is that 2 primes from the first category might be paired together. Consider this generalization last.

                                Do it this way and see if you can get to 1356.


                                NOTE: I'm not sure if the last step is necessary, I'm trying to see if I can prove whether or not that last step is needed.
                                Rhythm Simulation Guide
                                Comments, criticism, suggestions, contributions, etc. are all welcome.

                                Piano Etude Demon Fire sheet music

                                Comment

                                Working...