<?
def conv(val)
case val
when 10
"a"
when 11
"b"
when 12
"c"
when 13
"d"
when 14
"e"
when 15
"f"
when val>15
"f"
else
"#{val}"
end
end
def divtest(n)
x = 2
count = 2
while x**2 <= n
n%x==0 ? count+=1 : 0
x+=1
end
return count
end
def numspace(n)
if n<10
"000"
elsif n>=10 && n<100
"00"
elsif n>=100 && n<1000
"0"
end
end
out=File.new("factorcolors.html","w+")
out.syswrite("<body bgcolor=#000000> \n <font color=#220000>0001 ")
2.upto(9999) do |num|
if divtest(num) <= 15
out.syswrite("<font color=##{conv(divtest(num))}#{conv(divtest(num))}0000>#{numspace(num)}#{num}</font> ")
elsif (divtest(num) > 15) && (divtest(num) <= 30)
out.syswrite("<font color=#ff#{conv(divtest(num)-15)}#{conv(divtest(num)-15)}00>#{numspace(num)}#{num}</font> ")
elsif divtest(num) > 30
out.syswrite("<font color=#ffff#{conv(divtest(num)-30)}#{conv(divtest(num)-30)}>#{numspace(num)}#{num}</font> ")
end
num%25==0 ? out.syswrite("") : 0
end
out.close
?>
<?
def conv(val)
case val
when 10
"a"
when 11
"b"
when 12
"c"
when 13
"d"
when 14
"e"
when 15
"f"
when val>15
"f"
else
"#{val}"
end
end
def divtest(n)
x = 2
count = 2
while x**2 <= n
n%x==0 ? count+=1 : 0
x+=1
end
return count
end
def numspace(n)
if n<10
"000"
elsif n>=10 && n<100
"00"
elsif n>=100 && n<1000
"0"
end
end
out=File.new("factorcolors.html","w+")
out.syswrite("<body bgcolor=#000000> \n <font color=#220000>0001 ")
2.upto(9999) do |num|
if divtest(num) <= 15
out.syswrite("<font color=##{conv(divtest(num))}#{conv(divtest(num))}0000>#{numspace(num)}#{num}</font> ")
elsif (divtest(num) > 15) && (divtest(num) <= 30)
out.syswrite("<font color=#ff#{conv(divtest(num)-15)}#{conv(divtest(num)-15)}00>#{numspace(num)}#{num}</font> ")
elsif divtest(num) > 30
out.syswrite("<font color=#ffff#{conv(divtest(num)-30)}#{conv(divtest(num)-30)}>#{numspace(num)}#{num}</font> ")
end
num%25==0 ? out.syswrite("") : 0
end
out.close
?>
| |
![]() ![]()
|
|
|
|
Powered by: Trance Music & vBulletin Forums
|