Self numbers: Difference between revisions

m
→‎{{header|Phix}}: oops, put test back (got same results, but only because start==end)
m (→‎{{header|Phix}}: spotted another unnecessary test (counter!=startIndex), hoisted some loops into doneAfterAdding)
m (→‎{{header|Phix}}: oops, put test back (got same results, but only because start==end))
Line 924:
if doneAfterAdding(11,9) then return output end if
-- FastIf necessary, forward to the last self number before the lowest-order block containing the first number required.
while indexDiff>=98 andif counter!=startIndex dothen
-- The highest-order blocks whose ends this is thought to handle correctly contain 97,777,777,778 self numbers.
-- The difference between equivalently positioned numbers in these blocks is 1,000,000,000,001.
-- The figures for successively lower-order blocks are obtained by successively removing 7s and 0s!
atom indexDiff = 97777777778,
atom numericDiffindexDiff = 100000000000197777777778,
numericDiff = 1000000000001
while indexDiff>=98 and counter!=startIndex do
ifwhile counter+indexDiff >=98 and counter!=startIndex thendo
if counter+indexDiff => floor(indexDiff/10) +startIndex 1then
numericDiff indexDiff = floor(numericDiffindexDiff/10) + 1
numericDiff = floor(numericDiff/10) + 1
else
counter += indexDiffelse
currentSelf counter += numericDiffindexDiff
currentSelf += numericDiff
end if
end whileif
elseend while
end if
 
-- Sequencing loop, per lowest-order block.
while true do
7,818

edits