The exact fitness calulation will be this:

As you can see allowance was made for the fact that x mod 4 is easier to calculate in your head than x mod 7.

Let's see an example algorithm/calculation (March 2, 2005)

Can I cut down that 24 points for 12 constants? Hmmm... 5, 1, 1, 4, 6, 2, 4, 0, 3, 5, 1, 3. I don't see anything.

Surely, there is an algorithm that scores fewer than 42 points (and still comes out with the right answer).

Ryan

[ March 02, 2005: Message edited by: Ryan McGuire ]

Forget the algorithm -- you've just found the answer to life, the universe, and everything!Originally posted by Ryan McGuire:

Surely, there is an algorithm that scores fewer than42points

[ March 02, 2005: Message edited by: David Harkness ]

But he is near the answer.

I know the answer to the ultimite question!!!

Would your algo. account for leap year? To lazy to test!

Eric

Originally posted by Eric Pascarello:

I personally would just type this into the address bar:

Would your algo. account for leap year? To lazy to test!

Eric

Very nice if you're near a computer. Notice, however, that I'm going for easy to memorize/perform in one's head. One might infer that I don't plan on running this on a compueter.

The divide by four in the first step is what handles leap years.

Ryan

**Can I cut down that 24 points for 12 constants? Hmmm... 5, 1, 1, 4, 6, 2, 4, 0, 3, 5, 1, 3. I don't see anything.**

Not exactly in the rules, but why not call it 511462403513 (ie one constant ) and define the maths to pop the M'th digit? What are the 'points' costs of abitrary div, mod, power, log functions?

[edit - yeah yeah, i read it a bit closer ]

[ March 05, 2005: Message edited by: David O'Meara ]

Originally posted by Ryan McGuire:

...

The exact fitness calulation will be this:

...

2 things:

**Any**MOD operation that's really easy counts the same as a MOD 4. I would say that MOD 2, 4, 5, 10, 20, 40, 50, 100 all fit in this class. Maybe MOD 3 and 30 fit in here too. I'd have to say MOD 7 and 12 don't.

Ryan

Ryan McGuire wrote:Your assignment, should you choose to accept it, is to come up with the Day Of The Week calculation that is easiest to perform mentally. The algorithm has to work for for any date from Jan 1, 1900 to Dec 31, 2099. (Two centuries ought to be enough.) The final result of the calculation must come out so that a 0 represents Sunday, 1 Monday, ... 6 Saturday.

The exact fitness calulation will be this:

As you can see allowance was made for the fact that x mod 4 is easier to calculate in your head than x mod 7.

Let's see an example algorithm/calculation (March 2, 2005)

Can I cut down that 24 points for 12 constants? Hmmm... 5, 1, 1, 4, 6, 2, 4, 0, 3, 5, 1, 3. I don't see anything.

Surely, there is an algorithm that scores fewer than 42 points (and still comes out with the right answer).

Ryan

[ March 02, 2005: Message edited by: Ryan McGuire ]

A doubt in 3rd line. 24 points are for remembering 12 constants but adding will also accumulate 3 more points. Right?

Total points = 40, if consider MOD 100 for 2 points.

No better than yours, this will not work for leap years, this will only work for 21st century (2000s).

Reference: http://www.terra.es/personal2/grimmer/#Monthcodes

(works for year from 1900) (takes care of leap years)

Example date: 16-Feb-2009

...

...

Edit: The method posted was wrong. Realised the mistake.