HP Forums

Full Version: (49G) Series Factors of Natural Numbers, OEIS A027750
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For positive integer input N the programme returns the Nth element of the series of factors of the Natural Numbers.

For info on the series see

https://oeis.org/A027750

The time characteristic of the programme is linear on the input.

Code:

::
  CK1&Dispatch
  BINT1
  ::
    "  NTH FACTOR OF NATURAL SEQUENCE"
    DispCoord1
    SetDA3Temp
    COERCE
    ZEROZERO
    BEGIN
    SWAP#1+SWAP
    OVER
    FPTR2 ^#>Z
    FPTR2 ^DIVISext
    DUPLENCOMP
    ROT#+
    DUPUNROT
    5PICK
    #<
    WHILE
    DROP
    REPEAT
    '
    Z<
    FPTR2 ^SortList
    ROTDROPSWAP
    ROT
    #1--
    NTHCOMPDROP
  ;
;
Reference URL's