free geoip Anyone See the Pattern? - protected virtual void jaysonBlog
in

jaysonKnight.com

Welcome to my corner of the internet

protected virtual void jaysonBlog

A conduit to the voices in my head

Anyone See the Pattern?

[update] Understanding why for n=1;n+2 ((n^2)-1)%8==0 isn't the point of this exercise...look at the pattern in the results of each iteration. That's what has me baffled. Haacked has a great proof explaining what's going on on the left side of the operand, but I'm more interested in what's up with the right side. [/update]


This just popped into my head the other day for no other reason than to bug me:  Square all odd numbers starting with 1…subtract 1 from the result…then divide by 8.  Now look for the pattern in the results.

 
for (int i = 1; i < 100; i += 2)
 {
    int iSquared = (i * i); 
    if (((iSquared) - 1) % 8 == 0)
    {
        int result = ((iSquared - 1) / 8);
        Console.WriteLine(i + "^2 = " + iSquared + " - 1 = " + ((iSquared) - 1) + " / 8 = " + result);
    }
    else
    {
        Console.WriteLine("false"); 
    }
}
Console.ReadLine(); 

Squint for a second or 2 and you’ll see it.  Anyone out there with a degree in mathematics care to explain why that happens?

Share this post: Submit Anyone+See+the+Pattern%3f to Technorati | Submit Anyone+See+the+Pattern%3f to del.icio.us | Submit Anyone+See+the+Pattern%3f to digg.com | Submit Anyone+See+the+Pattern%3f to reddit.com | Submit Anyone+See+the+Pattern%3f to DotNetKicks | Add Anyone+See+the+Pattern%3f to Live Bookmarks
Only published comments... Oct 20 2005, 07:21 PM by Jayson Knight
Filed under:

Comments

 

Aaron Robinson said:

I don't know why your formula get the numbers, but that's the triangular number series... http://ptri1.tripod.com/#tri
October 21, 2005 4:45 AM
 

Aaron Robinson said:

October 21, 2005 4:48 AM
 

Keyvan Nayyeri said:

Well! 1- About your pattern: You've been hacked proved it but I'm looking for a way to prove his proof is true in all cases or give another proof. 2- I haven't use EiffelEnvision yet but try to check it asap. Thank you for references. 3- Maryam Ghaemmaghami (Scoble's wife) is Iranian and live in US. I don't like to check the stats of my website. Sometimes I use an application (It uses IIS logs) to check my referrers and total hits. It has good details. For my blog I think that the number of hits are depend on my posts so try to write better. Although I don't write to get better traffics. But thank you for StatsCounter it's a great website ;) On the other hand if you read my last posts I analyze the traffic with some statistical methods (Time Series) and they are absolutely better than this kind of stats. 4- This comment: http://nayyeri.net/archive/2005/10/08/207.aspx#238 beat me to give this link if you want to use GTalk with Trillian (Pro version): http://www.google.com/support/talk/bin/answer.py?answer=24077&topic=1415
October 21, 2005 9:35 AM
 

Haacked said:

Well my proof is true in all cases where x is an odd integer. The same is not true for n being even. I wrote more on the Triangular series in the comments of my post. The pattern you see is a consequence of the triangular series as the commenter said. Check out this... http://ptri1.tripod.com/ Scroll down to triangular numbers. See how they are a part of Pascal's triangle? Interesting eh?
October 21, 2005 9:49 AM
 

Haacked said:

I think I answered your question better in my latest post (http://haacked.com/archive/2005/10/21/10910.aspx). I try and explain WHY your formula gets the triangular series. It's an algebraic identity.
October 21, 2005 11:12 AM
 

Keyvan Nayyeri said:

Yesterday&amp;nbsp;Jayson Knight had pointed to a pattern in sequence of odd numbers and had written a code...
October 21, 2005 1:15 PM
 

Jayson Knight said:

And of course there's a Wiki on the triangular number series: http://en.wikipedia.org/wiki/Triangular_number
October 22, 2005 2:27 AM
 

protected virtual void jaysonBlog { said:

One thing that really bugs me about blogs is that it&amp;rsquo;s still really damn hard to find specific...
December 30, 2005 1:39 AM
 

Keyvan Nayyeri said:

YesterdayJayson Knight had pointed to a pattern in sequence of odd numbers and had written a code to

July 16, 2006 2:13 AM

Leave a Comment

(required)  
(optional)
(required)  
Add

About Jayson Knight

Jayson Knight was clueless to the computer programming world until he took a C++ class in college. The rest is proverbial history. He has been building applications targeting the .Net framework for 7 years, focusing mainly on internet technologies and database driven web application development.

Most recently he left the world of Corporate IT to finish up his degree in Chemistry, with an eye on Medical School and an Anesthesiology residency program. Read this post for more information.

He is also a Community Server MVP: Community Server is the software that runs this site, plus many others on the web. For more information, check out http://csmvps.com.

When he finds time to pry himself away from his computer and university studies, he can be found on the mountain bike trails when it's warm, and on the ski slopes when it's cold.

Copyright © :: JaysonKnight.com
External Content © :: Respective Authors

Terms of Service/Privacy Policy