(49G & 33s) OEIS A10785: Repdigit Numbers (in Human Readable Form) - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (49G & 33s) OEIS A10785: Repdigit Numbers (in Human Readable Form) (/thread-18952.html) |
(49G & 33s) OEIS A10785: Repdigit Numbers (in Human Readable Form) - Gerald H - 10-11-2022 05:20 PM For natural number input N the programme returns the Nth repdigit number in human readable form, eg for input 19531808 the programme returna {8 2170201} to be read as the figure eight repeated 2170201 times. http://oeis.org/A010785 Size: 94.500 CkSum: # C8AEh Code: :: RE: (49G) OEIS A10785: Repdigit Numbers (in Human Readable Form) - Joe Horn - 10-12-2022 03:52 AM The following User RPL program seems to produce the same outputs as your program, except for most inputs less than 1, which seems to me to be an acceptable limitation. \<< 1 - 9 IDIV2 SWAP 2 \->LIST -1 - \>> BYTES: 35.5 CRC: #3E16h RE: (49G) OEIS A10785: Repdigit Numbers (in Human Readable Form) - Gerald H - 10-12-2022 11:41 AM Thank you, Joe, for the clarity of your programme. For the 33s the programme A produces a 2-level version of the repdigit & programme B takes the result of A & returns the position in the OEIS series. Preserves stack. Code: 1. LBL A RE: (49G) OEIS A10785: Repdigit Numbers (in Human Readable Form) - Gerald H - 10-12-2022 04:33 PM Slightly improved 33s programme, also deals correctly with 0 as input. Code: 1. LBL A RE: (49G & 33s) OEIS A10785: Repdigit Numbers (in Human Readable Form) - Gerald H - 10-13-2022 07:06 AM Joe, I have adapted your suggestion for 33s & come up with Code: 1. LBL C which gives wrong answers, eg 8 111111111112 for input 999999999998 whereas my programme returns correct 8 111111111111 Is my implementation faulty? RE: (49G & 33s) OEIS A10785: Repdigit Numbers (in Human Readable Form) - Joe Horn - 10-13-2022 07:29 AM (10-13-2022 07:06 AM)Gerald H Wrote: ... No, you ran into a bug in the 33s when it evaluates "equations". If you store 999999999997 into N, then store IDIV(N:9)+1 in EQN, then execute it, the 33s returns the wrong answer (111111111112), whereas the 35s returns the correct answer (111111111111). Furthermore, the 33s returns the correct answer if you rewrite the program without using the EQN key. I do not not know whether this bug in the 33s has been found before, or if you are its first discoverer. RE: (49G & 33s) OEIS A10785: Repdigit Numbers (in Human Readable Form) - Gerald H - 10-13-2022 08:11 AM Edit: Line 14 corrected. Yes, now gives correct answers. Code: 1. LBL C |