Post Reply 
Tripartite Palindromic Partition of Integer (HP 50g) Challenge
03-26-2023, 08:40 AM (This post was last modified: 03-26-2023 09:04 AM by Gerald H.)
Post: #88
RE: Tripartite Palindromic Partition of Integer (HP 50g) Challenge
Further to posting # 76, towards the end of ALGO5 there is this segment

IF dn d3 - 10 MOD
THEN p1 1 1 PUT p1 n
1 PUT d2 DUP p1 2 ROT
PUT SWAP p1 n 1 - ROT
PUT ADD ADD ADD 'p1'
STO d3 1 - DUP p2 3
ROT PUT SWAP p2 n ROT
PUT ADD 'p2' STO dn
d3 - 10 MOD DUP p3 4
ROT PUT SWAP p3 n ROT
PUT ADD 'p3' STO
ELSE p1 1 1 PUT
p1 n 1 PUT d2 DUP p1
2 ROT PUT SWAP p1 n 1
- ROT PUT ADD ADD ADD
'p1' STO d3 2 - DUP
p2 3 ROT PUT SWAP p2
n ROT PUT ADD 'p2'
STO p3 4 1 PUT p3 n 1
PUT ADD 'p3' STO

END

the bold part of which is never visited.

Can you, 2old2randr, or anybody else construct a number using this branch?

My own variant of ALGO5 is

Code:
CKSUM # 40685d

SIZE 845.5

« 1 OVER SIZE 2
IQUOT 10 OVER ^ DUP
10 / + 5 PICK OVER
- I→NL REVLIST →
num p1 mult m s d
  «
    IF d m DUP2 GET
UNROT 1 + GET *
    THEN d REVLIST
    ELSE 'mult'
INCR DROP num s 2 *
- I→NL
    END NTYPE →
type special d p1
p2 p3
    «
      CASE p1 SIZE
2 MOD
        THEN d
REVLIST DUP SIZE →
d n
          « d DUP 2
GET OVER 3 GET ROT
n GET n ZEROLST 3
NDUPN DROP → d2 d3
dn p1 p2 p3
            « d2 p1
1 1 PUT n 1 PUT 2
PICK3 PUT n 1 - ROT
PUT 'p1' STO d3
              IF dn
OVER - 10 MOD
              THEN
1 - p2 3 PICK3 PUT
n ROT PUT 'p2' STO
dn d3 - 10 MOD p3 4
PICK3 PUT n ROT
              ELSE
HALT 2 - p2 3 PICK3
PUT n ROT PUT 'p2'
STO p3 4 1 PUT n 1
              END
PUT 'p3' STO d
REVLIST p1 CMPLST
p2 CMPLST p3 CMPLST
ALGO4
            »
          »
        END d p1 p2
p3 type HEAD "A" ==
        THEN ALGO2
        END ALGO4
      END
    » ROT s mult *
+ UNROT
  »
»
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Tripartite Palindromic Partition of Integer (HP 50g) Challenge - Gerald H - 03-26-2023 08:40 AM



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