Self numbers: Difference between revisions
m
→generator dictionary: pqhead -> gdhead
m (→{{header|Phix}}: added escuse) |
m (→generator dictionary: pqhead -> gdhead) |
||
Line 612:
Aside: the getd_index() check is often worth trying with phix dictionaries: if there is a high probability that
the key already exists, it will yield a win, but with a low probability it will just be unhelpful overhead.
<lang Phix>integer gd = new_dict(), g = 1,
function ng(integer n)
Line 627:
integer nxt
n += 1
while n=
while g<=
nxt = ng(g)
if getd_index(nxt, gd)=NULL then -- (~25% gain)
Line 635:
g += 1
end while
integer
while true do
if
-- ?{"ding",
end while
nxt = ng(
-- if getd_index(nxt, gd)=NULL then -- (~1% loss)
setd(nxt,0,gd)
-- end if
n += (n!=
end while
return n
|