Thread: Static vs. Dynamic Arrays, Getting Undefined Behavior

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    The larch
    Join Date
    May 2006
    Posts
    3,573
    For example, the factors of 30 are 1, 2, 3, 5, 6, 10, 15, 30.
    Euler problem 3 is about prime factors, otherwise finding the largest divisor would be a bit too trivial. The problem might look intimidating, but I suppose it can be solved with simple trial division. You definitely don't need an array that large, and whatever programming language, the memory usage would be too large.

    (Tried at ideone.com, Python with trial division by odd integers yields the answer in 0.03 seconds without any array. It only comes down to getting the algorithm right.)
    Last edited by anon; 01-17-2012 at 12:18 PM.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is x=x++; Undefined Behavior?
    By envec83 in forum C Programming
    Replies: 5
    Last Post: 10-04-2011, 01:27 AM
  2. Undefined behavior from VC6 to 2k5
    By m37h0d in forum C++ Programming
    Replies: 10
    Last Post: 06-22-2011, 07:56 PM
  3. openGL: textures, gluLookAt, and undefined behavior
    By MK27 in forum Game Programming
    Replies: 7
    Last Post: 04-28-2009, 10:12 AM
  4. Dynamic libs and undefined references
    By ccox421 in forum C Programming
    Replies: 5
    Last Post: 03-28-2009, 10:25 AM
  5. Static array is allocated in undefined area
    By esben in forum C Programming
    Replies: 4
    Last Post: 05-13-2006, 05:24 PM

Tags for this Thread