Post Reply 
(49G) OEIS A018800: Smallest prime that begins with n
10-03-2017, 09:39 AM
Post: #1
(49G) OEIS A018800: Smallest prime that begins with n
For natural number input N the programme returns the Nth element of the series

https://oeis.org/A018800

NB The sequence exhibits no gaps.

Size: 135.

CkSum: # 20661d

Code:
::
  CK1&Dispatch
  # FF
  ::
    DUP
    FPTR2 ^ISPRIME
    %0<>
    ?SEMI
    BINT7
    ONE_DO
    ZINT 10
    FPTR2 ^RMULText
    BINT10
    INDEX@
    FPTR2 ^RP#
    ONE_DO
    DUPINDEX@
    FPTR2 ^#>Z
    FPTR2 ^RADDext
    DUP
    FPTR2 ^ZPrime?
    ITE
    ::
      SWAPDROP
      ZEROZERO
      JSTOPSTO
      ExitAtLOOP
    ;
    ::
      DROP
      INDEX@
      BINT10
      #/
      DROP
      #3=
      case
      BINT4
      BINT2
    ;
    +LOOP
    LOOP
  ;
;
Find all posts by this user
Quote this message in a reply
Post Reply 




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