Jump to content

Self numbers: Difference between revisions

m
→‎{{header|Phix}}: inlined a routine
m (→‎{{header|Phix}}: replicated otrginal comment)
m (→‎{{header|Phix}}: inlined a routine)
Line 910:
output &= currentSelf
return (counter = endIndex)
end function
 
function getShorterRunLength()
-- Work out a shorter run length based on the most significant digit change about to happen.
integer shorterRunLength = 9,
temp = floor(currentSelf/1000)
while remainder(temp,10)=9 do
shorterRunLength -= 1
temp = floor(temp/10)
end while
return shorterRunLength
end function
 
Line 968 ⟶ 957:
end for
-- Two shorter runs, the second at an interval inversely related to their length.
integer shorterRunLengthinterval = getShorterRunLength()2,
intervalshorterRunLength = 29,
temp = floor(currentSelf/1000)
-- Work out a shorter run length based on the most significant digit change about to happen.
while remainder(temp,10)=9 do
integer shorterRunLength -= 9,1
temp = floor(temp/10)
end while
 
for i=1 to 2 do
if doneAfterAdding(interval) then return output end if
7,820

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.