当前位置: 首页 > 图文教程 > 网络编程 > ASP > 分解质因数(asp 分布递归法)

ASP
ASP进阶教程Ⅰ:循序渐进学留言薄
ASP进阶教程Ⅱ:一个简单的留言簿
ASP进阶教程Ⅲ:给留言簿润下色
ASP进阶教程Ⅵ:留言簿在线删除留言
ASP进阶教程Ⅴ:留言簿在线留言编辑(一)
ASP进阶教程Ⅴ:留言簿在线留言编辑(二)
ASP进阶教程Ⅳ:加入精彩留言
ASP进阶教程Ⅸ:留言查询功能(一)
ASP进阶教程Ⅸ:留言查询功能(二)
ASP进阶教程Ⅷ:数据库版本的留言簿
ASP基础讲座(上)
ASP系列讲座(一)关于 Active Server Pages
ASP系列讲座(二)ASP 的新功能
Asp用于分页的两个函数
ASP与Oracle连接时的TNS错误
小工具:统计有多少行JS代码和ASP代码,并有多少字节
一个xmlhttp读取xml的例子
ASP终极防范上传漏洞
防止网站内容被人小偷和采集的ASP代码
批量判断域名是否被注册程序代码

ASP 中的 分解质因数(asp 分布递归法)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 50 ::
收藏到网摘: n/a

  ***start input.asp***
<% thenum= request("num") %>
<style type="text/css">
<!--
.trees {  border-color: black black black #666666; padding-left: 12px; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 3px; margin-top: 2px; margin-bottom: 2px}
-->
</style>

<div class = "trees" id="tree<%=thenum%>"><%=thenum%><span id="follow<%=thenum%>"><iframe name = "agent<%=thenum%>" style="display:none" src="prime_number.asp?num=<%=thenum%>"></iframe></span></div>
***end input.asp***

***start prime_number.asp***
<%
IsPrimeNumber = false
thenum = request("num")
if thenum = 2 or thenum = 1 then
    IsPrimeNumber = false
else
    for i = 2 to thenum -1
        if thenum / i = int(thenum / i) then IsPrimeNumber = true: m = i : exit for
    next
end if
if IsPrimeNumber = false then %>

    <script>
    var htmltext = '<div class = "trees"><%=thenum%>*</div>';
    parent.follow<%=thenum%>.innerHTML = htmltext;
    </script>

<%else%>
        <%k = thenum / m%>
        <script>
        var htmltext = '<div class = "trees"><%=m%>*</div><div class = "trees" id="tree<%=k%>"><%=k%><span id="follow<%=k%>"><iframe name = "agent<%=k%>" style="display:none" src="prime_number.asp?num=<%=k%>"></iframe></span></div>';
        parent.follow<%=thenum%>.innerHTML = htmltext;
        </script>

<%end if%>
***end prime_number.asp***

算法应用:分布多线程树读取