dragonkz00

Sorano Ryuji · @dragonkz00

24th May 2014 from TwitLonger

;999*999は998001つまり最大でも997799以下の回文数となる。
Lset = 997
*mugen
cls
;回文数を算出
xxx = str(Lset)
Kbun = int(xxx+strmid(xxx,2,1)+strmid(xxx,1,1)+strmid(xxx,0,1))
Kbun2 = Kbun
;Kbunを素因数分解
fil = ""
notesel fil
idx = 2
repeat
if Kbun \ idx = 0{
noteadd str(idx)
Kbun = Kbun / idx
idx = 1
}
idx++
if Kbun = 1 : break
loop
if notemax = 1 : mes "回文が素数" : stop
idx = 0
repeat notemax,1
idx = idx + cnt
loop
repeat idx,1
idx = cnt
a = 1
b = 1
repeat notemax
noteget xxx,cnt
idx2 = int(xxx)
if idx \ 2 = 0{
a = a * idx2
}else{
b = b * idx2
}
idx =idx / 2
loop
idx = 0
if 1000 > a : idx++
if 1000 > b : idx++
if idx = 2 : mes "結果判明:"+str(Kbun2)+" 片方の数値"+a : stop
loop
Lset--
if Lset = 100 : mes "データ発見せず" : stop
goto *mugen

Reply · Report Post