The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(50g) OEIS A028842: Product of Digits is a Prime
09-05-2017, 02:43 PM (This post was last modified: 09-10-2017 11:34 AM by Gerald H.)
Post: #1
(50g) OEIS A028842: Product of Digits is a Prime
For integer input N the programme returns the Nth element of the series

https://oeis.org/A028842

where the elements are all numbers in naturally ascending order whose product of digits is a prime.

I am particularly unhappy with this

4. OVER
WHILE DUP2 <
REPEAT OVER -
SWAP 4. + SWAP
END

section of code & would welcome a speedier method of calculating the 2 numbers deposited on the stack.

SIZE 173.

CKSUM # 502Fh

Code:
« 4. OVER
  WHILE DUP2 <
  REPEAT OVER -
SWAP 4. + SWAP
  END "" 1. 4. ROLL
4. /
  START "1" +
  NEXT OBJ→ SWAP 4.
IDIV2 DUP
  IF
  THEN DUP 3. ==
    IF
    THEN DROP 4
    END
  ELSE DROP 1. - 6
  END 10 ROT R→I ^
* + SWAP DROP
»
Find all posts by this user
Quote this message in a reply
Post Reply 


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



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