Post Reply 
Weekend Challenge Sharpened: Missing Positions in Champernowne's Constant
08-04-2015, 05:04 AM
Post: #5
RE: Weekend Challenge: Missing Positions in Gods' Triangle
(07-30-2015 04:53 PM)Gerald H Wrote:  Write a programme that on input of the index of a number, say C, that cannot appear as position of any integer returns C, eg

for index


the programme returns


as 11 is the lowest number not representing the start position of an integer.

The following does the trick:

  → c 
    Σi Σc ch
    1 CF
      ch ALOG 9 * '' STO
      ch 1 + '' STO
      ch '' STO * '' STO
      IF Σc + c ≥ THEN
        1 SF
      ELSE 'Σc' STO+ * 'Σi' STO+
      1 'ch' STO+   
    c Σc - '' STO / FLOOR '' STO
    Σi * MOD
    + +

As requested, it returns 11 for an input of 1, 1089 for an input of 690, and, for example, 1124999998 for an input of 987654321.

[Here i refers to an index into God's Number, c refers to the "dead" digits of God's Number where no integer starts, and ch (characteristic) is the power of ten currently being addressed as we iterate from the "units" to the "tens" to the "hundreds" etc.. All local variables are initialised to zero except for the input value, c.]
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Weekend Challenge: Missing Positions in Gods' Triangle - nlj - 08-04-2015 05:04 AM

User(s) browsing this thread: 1 Guest(s)