HP Forums
(50g) Integer Cube Root of an Integer - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (50g) Integer Cube Root of an Integer (/thread-8967.html)



(50g) Integer Cube Root of an Integer - Gerald H - 09-02-2017 03:34 PM

For positive integer input N the programme returns the integer cube root, ie greatest integer cubed less than or equal to N.

For a random 1000 digit number

33723332557553775353525757337573537755533522772333232727225373253275725533335725​27325352752552573533222555227325357735332722375322535733533357722577325522733537​22235277532535355573272752525725227232537255772272757257527237257753332727532572​73327232573752273222237775335227233255273532577535572353227753773757222523352237​22525757355532355535723335557752773733555333732222737255732752335355532352737727​25275753355322773722522255535357537273523327777757235335733357535377323227722775​72252537733375735527537325777753357533273727575335727257327253772727233237537522​23733772357772257737732225553352323372277333273325325352557275755222353722537332​52737773327332777253377752353222323577223275257722273575357223737723575273533225​35777235737222727575772757573223575375222233277233752352773775273227357573557753​72275225532532322223772373575352252555552237577775733733523277325773755253527377​25532772333735733533753327773275227327573532275372557727335525352752377255353752​7735327732557323757327355353375255332733

the programme returns the integer cube root

14996048226776396981365120549516562555070959721242805493773661164963544888188015​56346435842736638915543782177873566529474838650069733763644482058793228038399075​85820587978412754592271325754859922095805411972846649767779396263186073689402512​30957274613534313832689378142569694744490574471694589142990940757353632225827412​71212646504465

in 70s.

Code:
::
  CK1&Dispatch
  # FF
  ::
    Z2_
    OVER
    FPTR2 ^Z>ZH
    FPTR2 ^ZBits
    BINT3
    #/
    ROTROT2DROP
    #1+
    FPTR2 ^PPow#
    BEGIN
    DUP
    BINT3
    FPTR2 ^PPow#
    DUP
    4PICK
    DUP
    FPTR2 ^RADDext
    FPTR2 ^RADDext
    3PICK
    FPTR2 ^RMULText
    SWAPDUP
    FPTR2 ^RADDext
    4PICK
    FPTR2 ^RADDext
    FPTR2 ^ZDIVext
    DROP
    DUPUNROT
    Z>
    NOT_UNTIL
    SWAPDROP
  ;
;
SIZE 127.5

CKSUM # 27E5h


RE: (50g) Integer Cube Root of an Integer - rprosperi - 09-02-2017 07:06 PM

(09-02-2017 03:34 PM)Gerald H Wrote:  For a random 1000 digit number

33723332557553775353525757337573537755533522772333232727225373253275725533335725​27325352752552573533222555227325357735332722375322535733533357722577325522733537​22235277532535355573272752525725227232537255772272757257527237257753332727532572​73327232573752273222237775335227233255273532577535572353227753773757222523352237​22525757355532355535723335557752773733555333732222737255732752335355532352737727​25275753355322773722522255535357537273523327777757235335733357535377323227722775​72252537733375735527537325777753357533273727575335727257327253772727233237537522​23733772357772257737732225553352323372277333273325325352557275755222353722537332​52737773327332777253377752353222323577223275257722273575357223737723575273533225​35777235737222727575772757573223575375222233277233752352773775273227357573557753​72275225532532322223772373575352252555552237577775733733523277325773755253527377​25532772333735733533753327773275227327573532275372557727335525352752377255353752​7735327732557323757327355353375255332733

I imagine my comment is unrelated to your program, but this does not look like a "random" number to me, it contains only the digits 2,3, 5 and 7.


RE: (50g) Integer Cube Root of an Integer - Gerald H - 09-02-2017 08:51 PM

Well yes, not really random & yet very random.

I wanted to see what a 1,000 digit 2357 number looks like & you never know, it just might have been a cube.


RE: (50g) Integer Cube Root of an Integer - pier4r - 09-02-2017 10:19 PM

(09-02-2017 07:06 PM)rprosperi Wrote:  I imagine my comment is unrelated to your program, but this does not look like a "random" number to me, it contains only the digits 2,3, 5 and 7.

[Image: 321a39e06d6401301d80001dd8b71c47]


RE: (50g) Integer Cube Root of an Integer - Gerald H - 09-03-2017 07:45 AM

What do you think, Bob, of the cube root above as a source of random digits?


RE: (50g) Integer Cube Root of an Integer - rprosperi - 09-04-2017 12:31 AM

(09-03-2017 07:45 AM)Gerald H Wrote:  What do you think, Bob, of the cube root above as a source of random digits?

Well, pier4's cartoon really says it all, you can never be sure just how random a sample number is, your original number could be just as random as any other; it just appears suspicious when it only contains a limited number of digits.

The cube root does appear to be more random, but that doesn't mean much either.

I was just curious if the sample used had been selected for some specific reason.