It's not very elegant, but the most efficient method (assuming it's always 3
that you care about) might be to put all the values you care about into a
list in the application or request scope and do a listfind.  You can't have
that many entries before you hit the CF biggest-number limit.

-----Original Message-----
From: Jon Hall [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 27, 2000 12:36 PM
To: CF-Talk
Subject: Power of 3


Anyone have an idea on how to check to see if a value is a power of 3?

I have a loop that needs to fire an event at every power of three that it
hits and I am having problems getting my brain around how I need to do this.
My first thoughts are to have a loopcounter and each time around the counter
is incremented check and see if the counter value is the Next power of
three.
The end effect is that the if statement is triggered the following
intervals: 3,9,27,81...

jon

----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to