User talk:Rrenaud

From Algorithmist
Jump to navigation Jump to search

I liked 10798 (Be wary of Roses) and 10236 (The Fib Primes).. I think my favorite one is the Hendrie Sequence (forgot number!) Larry 00:25, 26 Jul 2005 (EDT)

I am having precision problems with fib primes. When I use long double and all the corresponding functions (sqrtl, log10l), it seems to work, but when I just use double, I get off by 1 in the answers for about 70 of the inputs. The uva judge doesn't seem to have the higher precision math functions though. So I am thinking about hardcoding the ~700 hardest cases and using double, or trying to implement log10l and sqrtl myself. Both are pretty nasty solutions though :(. --Rrenaud 06:56, 26 Jul 2005 (EDT)


hrmm.. mine was pretty straightforward, actually. My loop for the fib is basically something like:

  fib[0] = 0.0;
  fib[1] = 1.0;
  for ( i = 2; i < 261000; i++ ) {
    fib[i] = fib[i-1] + fib[i-2];
    if ( fib[i] >= 1e9 && fib[i-1] >= 1e9 )
      fib[i] /= 10, fib[i-1] /= 10;
  }

which was good enough, at least for the test cases.. Larry 16:46, 10 Aug 2005 (EDT)