HP Forums
(50G) See & Speak Programme - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (50G) See & Speak Programme (/thread-3776.html)



(50G) See & Speak Programme - Gerald H - 05-04-2015 11:01 AM

The programme VERB takes an integer from the stack & returns to stack level Y the pre-period & to stack level X the period of the list of numbers stored in variable VLIST, each of the numbers in the list a description of the previous list entry.

eg For seed 89 the second number in the list is 1918, as 89 consists of "one nine one eight", the third in the list is 191821 as 1918 is "one nine one eight two ones", and so on until the representation becomes periodic.

By the way, what's the lowest self-descriptive number?

For entry 89 we see:

X: Pre-period:13
Y: Period:2

In variable VLIST

{ 89 1918 191821 19181231 1918131241 191814131251 19181514131261 1918161514131271 191817161514131281 192817161514131291 291817161514132281 192817161514133271 191827161514232271 "°" 191827161514134261 191817261524132271 }

VERB

::
CK1&Dispatch
# FF
::
DUP
ONE{}N
SWAP
FPTR2 ^Z>S
ZEROSWAP
::
BEGIN
BINT0
BINT10
NDUPN
'
NULLLAM
SWAP
NDUPN
DOBIND
DUPLEN$
#1+_ONE_DO
DUPINDEX@
SUB$1#
BINT47
#-DUP
GETLAM
#1+SWAP
PUTLAM
LOOP
NULL$
BINT11
ONE_DO
INDEX@
GETLAM
DUP#0=ITE
DROP
::
#>$
INDEX@
#1-
#>$
&$
SWAP&$
;
LOOP
ABND
SWAPDROP
SWAP#1+SWAP
DUP
FPTR2 ^S>Z
4PICK
FPTR2 ^ListPos
DUP#0=
NOTcase
AGAIN
DROPROT
OVER
FPTR2 ^S>Z
>TCOMP
3UNROLL
AGAIN
;
RDROP
#1-
SWAPDROPDUP
4ROLL
"°"
4PICK
#1+
FPTR2 ^INSERT{}N
'
ID VLIST
?STO_HERE
ROT
SWAP#-
FPTR2 ^#>Z
"Period"
>TAG
SWAP
FPTR2 ^#>Z
"Pre-period"
>TAG
SWAP
;
;