Post Reply 
(50g) OEIS A028842: Product of Digits is a Prime
09-06-2017, 06:43 PM
Post: #7
RE: (50g) OEIS A028842: Product of Digits is a Prime Sequence
& here a version which for input

35918081

returns

:# Digits: 4238 (total number of digits in answer)

:Pos: 1318 (position of the non-1 digit, counting from right)

:Digit: 2 (the embedded prime digit)

& is free from approximate arithmetic.

ID SQR0 is an integer square root programme you can find here:

http://www.hpmuseum.org/forum/thread-8992.html

Size: 273.5

CkSum: # 3973h

Code:
::
  CK1&Dispatch
  # FF
  ::
    FPTR2 ^ZAbs
    DUPDUP
    ZINT 2
    FPTR2 ^ZMod
    FPTR2 ^RADDext
    ZINT 2
    FPTR2 ^ZQUOText
    '
    ID SQRT0
    EvalNoCK
    DUP
    ZINT 4
    FPTR2 ^RMULText
    UNROTDUP
    ZINT 1
    FPTR2 ^RSUBext
    FPTR2 ^RMULText
    DUP
    FPTR2 ^RADDext
    FPTR2 ^RSUBext
    SWAP
    ZINT 4
    FPTR2 ^ZQUOText
    "# Digits"
    >TAG
    SWAP
    ZINT 4
    FPTR2 ^IDIV2
    SWAP
    ZINT 1
    FPTR2 ^RADDext
    SWAP
    ::
      ZINT 3
      EQUALcasedrop
      ZINT 4
      DUP
      ZINT 0
      EQUAL
      NOT?SEMI
      DROP
      ZINT 1
      FPTR2 ^RSUBext
      ZINT 6
    ;
    ZINT 1
    FPTR2 ^RADDext
    "Digit"
    >TAG
    SWAP
    "Pos"
    >TAG
    SWAP
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (50g) OEIS A028842: Product of Digits is a Prime Sequence - Gerald H - 09-06-2017 06:43 PM



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