My Weblog

Blog about programming and math

Project Euler 120

A simple observation is when n is even then remainder will be simply 2 and if n is odd then remainder will 2an%(a*a). Then i brute forced and got the answer. After looking into forum many solvers used the fact that when a is even then maximum value will be a^2-2a and when a is odd then maximum value will be a^2-a.

Advertisements

March 24, 2010 - Posted by | Programming

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: