Talk:Proper divisors: Difference between revisions

From Rosetta Code
Content added Content deleted
Line 10: Line 10:
::::I like the classification task, but this one seems like a very small change vs. divisors ([[Factors of an integer]]). If we have this, then why not restricted divisors (remove 1 and n) as well? It seems like the obvious implementation here is "get divisors using the other task, then remove n" which isn't very interesting (in my opinion). [[User:Danaj|Danaj]] ([[User talk:Danaj|talk]]) 14:33, 17 December 2014 (UTC)
::::I like the classification task, but this one seems like a very small change vs. divisors ([[Factors of an integer]]). If we have this, then why not restricted divisors (remove 1 and n) as well? It seems like the obvious implementation here is "get divisors using the other task, then remove n" which isn't very interesting (in my opinion). [[User:Danaj|Danaj]] ([[User talk:Danaj|talk]]) 14:33, 17 December 2014 (UTC)
:::::Actually, it's "get factors using the other task then remove n unless n is 1", which is... at least as interesting as fizzbuzz? But I think I see what you are getting at -- I would not want to see too many minor-variation tasks. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 17:30, 17 December 2014 (UTC)
:::::Actually, it's "get factors using the other task then remove n unless n is 1", which is... at least as interesting as fizzbuzz? But I think I see what you are getting at -- I would not want to see too many minor-variation tasks. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 17:30, 17 December 2014 (UTC)
::::::The "unless n is 1" has been corrected -- 1 is not an exception. Some sources include the negatives of the proper divisors as well, leading some to the definition including "...is a positive divisor...". The input 0 is another oddball case -- Wolfram/Alpha and Pari/GP don't agree on its divisors, for example. [[User:Danaj|Danaj]] ([[User talk:Danaj|talk]]) 18:43, 17 December 2014 (UTC)


== Definition ==
== Definition ==

Revision as of 18:44, 17 December 2014

Dupe?

The explanation on the J implementation here makes a good point: is this task just a trivial change of Factors of an integer? --Mwn3d (talk) 17:09, 16 December 2014 (UTC)

Yep, it is allied, but deficient, perfect, abundant number classifications as well as Amicable pairs are based on them. --Paddy3118 (talk) 18:34, 16 December 2014 (UTC)
It seems like it'd be easier to just use the "proper divisors" definition in other tasks where appropriate rather than having a separate task with essentially the same code (except for maybe esoteric languages). Especially since any definition with "factors of an integer" could be made using "proper divisors" with one or two extra additions or subtractions. It just doesn't seem worth it. It looks to me like having a task to "print the number 3" and another task to "print the number before 4". --Mwn3d (talk) 19:11, 16 December 2014 (UTC)
From my point of view 'factors' is simpler than 'Proper divisors'. Specifically: 'Proper divisors' are the factors of a number except the number itself except if the number itself is 1. I don't have an opinion on the redundancy, but if people decide that the redundancy is bad, I'd hate to sacrifice the simple concept of 'factors' (all of them, for all cases, instead of just a special case for 1). --Rdm (talk) 21:48, 16 December 2014 (UTC)
OK. I understand your point. I have just added the third of the triplet of tasks Abundant, deficient and perfect number classifications, they do form a tight triplet, but I am probably pushing it cos I started it. Could it stay guys? (I am definitely not impartial - would be nice to have one champion though in what I hope will be a debate) --Paddy3118 (talk) 19:26, 16 December 2014 (UTC)
Yes I see those, but like I said, those could easily be made using the sum of the old factors task definition and "2n" on the right side of the formulas. Seems like "2 pi" and "tau" to me, but let's see if anyone else has an opinion on whether this task should stay. --Mwn3d (talk) 19:37, 16 December 2014 (UTC)
I like the classification task, but this one seems like a very small change vs. divisors (Factors of an integer). If we have this, then why not restricted divisors (remove 1 and n) as well? It seems like the obvious implementation here is "get divisors using the other task, then remove n" which isn't very interesting (in my opinion). Danaj (talk) 14:33, 17 December 2014 (UTC)
Actually, it's "get factors using the other task then remove n unless n is 1", which is... at least as interesting as fizzbuzz? But I think I see what you are getting at -- I would not want to see too many minor-variation tasks. --Rdm (talk) 17:30, 17 December 2014 (UTC)
The "unless n is 1" has been corrected -- 1 is not an exception. Some sources include the negatives of the proper divisors as well, leading some to the definition including "...is a positive divisor...". The input 0 is another oddball case -- Wolfram/Alpha and Pari/GP don't agree on its divisors, for example. Danaj (talk) 18:43, 17 December 2014 (UTC)

Definition

I don't believe the definition used is correct. In particular "always includes 1" doesn't follow from the definition given at the linked site, or MathWorld or OEIS.

A simple definition from Mathworld: "A positive proper divisor is a positive divisor of a number n, excluding n itself." Danaj (talk) 21:09, 16 December 2014 (UTC)

From which we see that 1 will always divide an integer without remainder. I make a point about mentioning 1 as a reference stated that sometimes the same term "proper divisors" is used when 1 is excluded. --Paddy3118 (talk) 18:25, 16 December 2014 (UTC)
I guess my point was about the input 1. The proper divisors of 1 should be the empty set, while all the current implementations are using the "always includes 1" to mean it should be {1}. Another interesting case is the input 0, but I think we can ignore that. Danaj (talk) 21:09, 16 December 2014 (UTC)