Published in: ASP
URL: http://reusablecode.blogspot.com/2008/06/factors.html
<% ' Copyright (c) 2008, reusablecode.blogspot.com; some rights reserved. ' ' This work is licensed under the Creative Commons Attribution License. To view ' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or ' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California ' 94305, USA. ' Returns an array containing all factors for a given integer. function factors(x) dim i dim arrFactors arrFactors = Array() for i = 2 to x if x mod i = 0 then redim preserve arrFactors(UBound(arrFactors) + 1) arrFactors(UBound(arrFactors)) = i end if next factors = arrFactors end function %>
Comments
Subscribe to comments
You need to login to post a comment.

Fixed a "subscript out of range" bug.