Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

combinatin

Name: Anonymous 2012-02-15 11:12

What's the Scheme equivalent of this?:

for (i = 0; i < N; i++) {
  for (j = 0; j < N; j++) {
    a = i*j;
  }
}


Context:
I was doing problem 4 of Project Euler, which is

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.

And that's simple enough. The thing is that I'm trying to do the problems with Scheme. I don't know much about Scheme, except what's in the first chapter of SICP. I managed to compute the number using Scheme, but it's slow as fuck. I did it with C with something similar as the code posted, and it's very fast.

Name: Anonymous 2012-02-15 12:25

a = (N-1)*(N-1);
ZOMG OPTIMIZED

Name: Anonymous 2012-02-15 16:35

>>2
fucking homo

Name: Anonymous 2012-02-15 21:57

not compiled;didn't read

Don't change these.
Name: Email:
Entire Thread Thread List