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 
(48G) GCD: Greatest Common Divisor
08-30-2018, 03:21 PM
Post: #1
(48G) GCD: Greatest Common Divisor
This solution is from: HP 48 Insights Programs
Contains all the example programs from the book HP 48 Insights Part 1, by Bill Wickes.

INSIGHTS/PROGRAMS/GCD:
Code:
%%HP: T(3)A(D)F(.);
\<<
  WHILE DUP2 MOD
DUP 0 \=/
  REPEAT ROT DROP
  END ROT DROP2
\>>

However we can make it a bit shorter:
Code:
«
  WHILE DUP
  REPEAT SWAP OVER MOD
  END DROP
»

Example:

54 24
GCD

6
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(48G) GCD: Greatest Common Divisor - Thomas Klemm - 08-30-2018 03:21 PM



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