Self numbers: Difference between revisions
Content added Content deleted
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: | Line 924: | ||
if doneAfterAdding(11,9) then return output end if |
if doneAfterAdding(11,9) then return output end if |
||
-- |
-- If necessary, forward to the last self number before the lowest-order block containing the first number required. |
||
⚫ | |||
-- The highest-order blocks whose ends this is thought to handle correctly contain 97,777,777,778 self numbers. |
-- 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 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! |
-- The figures for successively lower-order blocks are obtained by successively removing 7s and 0s! |
||
atom indexDiff = 97777777778, |
|||
atom indexDiff = 97777777778, |
|||
numericDiff = 1000000000001 |
|||
⚫ | |||
while indexDiff>=98 and counter!=startIndex do |
|||
indexDiff |
if counter+indexDiff > startIndex then |
||
indexDiff = floor(indexDiff/10) + 1 |
|||
numericDiff = floor(numericDiff/10) + 1 |
|||
⚫ | |||
else |
|||
counter += indexDiff |
|||
currentSelf += numericDiff |
|||
⚫ | |||
end |
end if |
||
⚫ | |||
⚫ | |||
-- Sequencing loop, per lowest-order block. |
-- Sequencing loop, per lowest-order block. |
||
while true do |
while true do |