|
又要质因数分解。
这种题用SQL总是有种无力的感觉。
SQL:
with targ as (select 200000 arg from dual)
,t1 as (select /*+ MATERIALIZE */ rownum n from targ connect by rownum<=arg)
,t2 as (select /*+ MATERIALIZE */ column_value d from targ, table(pkg_prim2.seive_numlist((arg/2))))
,t3 as (select n, count(d) dn
from t1, t2 where n>d and mod(n, d) = 0 group by n having count(d)=4 )
--select * from t3 where dn=3
select connect_by_root(n) from t3 where level=4 connect by n=prior n+1
放到那里不管它, 看看多久能出来结果。
CONNECT_BY_ROOT(N)
------------------
134043
Executed in 1835.078 seconds
SQL>
吼吼, 跑了半个小时! |
|