idivis inWP34s
11-27-2015, 08:24 PM (This post was last modified: 11-27-2015 08:35 PM by Dieter.)
Post: #2
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: idivis inWP34s
(11-27-2015 07:26 PM)ggauny@live.fr Wrote:  I am working to calcul all divisors of a number positiv and different of zero, in this last case all numbers are divisors of course. It is because I love fun arithmetics thing like perfects numbers and so on.

So you want all divisors, sorted in ascending order?
E.g. 1235 should return 1 5 13 19 65 95 247 and finally 1235?

(11-27-2015 07:26 PM)ggauny@live.fr Wrote:  I have do a flowchart (I hope attachement will run, I encounter somme issues this later days with this).

An implementation of your flowchart could look like this:

Code:
FILL Clx STO L     // store divisor i in L x<> L INC X     // i:=i+1 x≥y?      // i >= n? RTN       // then quit (should display n as the last divisor) RMDR      // calculate n mod i (while i stays in L) x≠0?      // n not divisble by i ? BACK 006  // test next divisor x<> L STOP      // else display i BACK 008

And here is a version that tests up to n/2:

Code:
FILL Clx STO L     // store divisor i in L x<> L INC X     // i:=i+1 RCL+X     // compare n and 2*i while keeping i in L x≤y?      // 2i ≤ n  resp.  i ≤ n/2 ? SKIP 002  // then continue DROP RTN       // else display n and quit  x<> L     // recall i again RMDR      // calculate n mod i (while i stays in L) x≠0?      // n not divisble by i ? BACK 010  // test next divisor x<> L STOP      // else display i BACK 012

Now, how did you do it?

Dieter
 « Next Oldest | Next Newest »

 Messages In This Thread idivis inWP34s - ggauny@live.fr - 11-27-2015, 07:26 PM RE: idivis inWP34s - Dieter - 11-27-2015 08:24 PM RE: idivis in WP 34S - walter b - 11-27-2015, 08:34 PM RE: idivis inWP34s - Dieter - 11-27-2015, 08:53 PM RE: idivis inWP34s - walter b - 11-27-2015, 10:27 PM RE: idivis inWP34s - Dieter - 11-27-2015, 11:12 PM RE: idivis inWP34s - Marcus von Cube - 11-28-2015, 11:14 AM RE: idivis inWP34s - walter b - 11-28-2015, 12:01 PM RE: idivis inWP34s - Thomas Klemm - 11-28-2015, 12:14 AM RE: idivis inWP34s - ggauny@live.fr - 11-28-2015, 06:30 AM RE: idivis inWP34s - Dieter - 11-28-2015, 07:35 PM RE: idivis inWP34s - ggauny@live.fr - 11-28-2015, 07:28 AM RE: idivis inWP34s - Thomas Klemm - 11-28-2015, 11:25 AM RE: idivis inWP34s - Didier Lachieze - 11-29-2015, 12:25 PM RE: idivis inWP34s - ggauny@live.fr - 03-27-2016, 09:34 AM RE: idivis inWP34s - ggauny@live.fr - 11-29-2015, 12:34 PM RE: idivis inWP34s - ggauny@live.fr - 11-29-2015, 12:47 PM RE: idivis inWP34s - Paul Dale - 03-27-2016, 10:26 AM RE: idivis inWP34s - ggauny@live.fr - 03-27-2016, 10:43 AM RE: idivis inWP34s - Didier Lachieze - 03-27-2016, 11:17 AM RE: idivis inWP34s - Paul Dale - 03-27-2016, 11:14 AM RE: idivis inWP34s - ggauny@live.fr - 03-27-2016, 12:00 PM

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