Post Reply 
(50g) OEIS A028842: Product of Digits is a Prime
09-06-2017, 11:57 AM
Post: #5
RE: (50g) OEIS A028842: Product of Digits is a Prime Sequence
Very nice, problem solved up to limit of 50g's memory.

But is it?

For input

35918081

the programme returns

11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111112111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​11111111111111111111111111111111111111111111111111111111111111111111111111111111​111111111111111111111111111111111111111111111111111111111111111111111111111111

which is correct, but where's the 2? Aha! There it is. OK, so where is it? Position please.

Standard decimal number system is unsuited to large numbers.

Accordingly the programme below for the same input 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)

which I think displays the answer more clearly.

So we can now represent the answer for much larger input given some way of getting Joe's programme to work exactly.

Suggestions welcome.

Size: 185.5

CkSum: # 9CBBh

Code:
::
  CK1&Dispatch
  BINT1
  ::
    %ABS
    %2
    %/
    %SQRT
    DUP
    %0
    RNDXY
    %4
    %*
    SWAP
    %.5
    %+
    %FP
    OVER
    %*
    %CEIL
    SWAP
    %4
    %/
    FPTR2 ^R>Z
    "# Digits"
    >TAG
    SWAP
    FPTR2 ^R>Z
    ZINT 4
    FPTR2 ^IDIV2
    FPTR2 ^Z>R
    SWAP
    FPTR2 ^Z>R
    %1+
    SWAP
    ::
      %3
      EQUALcasedrop
      %4
      DUP%0=
      NOT?SEMI
      DROP
      %1-
      %6
    ;
    %1+
    FPTR2 ^CK2Z
    "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 11:57 AM



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