Project

General

Profile

Feature #4831

Integer#prime_factors

Added by mame (Yusuke Endoh) almost 7 years ago. Updated 3 months ago.

Status:
Assigned
Priority:
Normal
Target version:
-
[ruby-core:36764]

Description

Hello,

lib/prime provides Integer#prime_division, but I always forget the name.
I think that #prime_factors is more suitable. I'd like to hear opinions
of English natives. What do you think?

--
Yusuke Endoh mame@tsg.ne.jp

History

#1 [ruby-core:38555] Updated by drbrain (Eric Hodel) over 6 years ago

Yes, #prime_factors and #factors are synonyms.

#2 Updated by shyouhei (Shyouhei Urabe) about 6 years ago

  • Status changed from Open to Assigned

#3 [ruby-core:48263] Updated by yhara (Yutaka HARA) over 5 years ago

  • Target version changed from 2.0.0 to 2.6

#4 Updated by naruse (Yui NARUSE) 4 months ago

  • Target version deleted (2.6)

#5 [ruby-core:84976] Updated by yugui (Yuki Sonoda) 3 months ago

I am not against adding such an alias but I'd like to think with more inputs. At this moment, I don't have strong reason to justify the name.

From a certain perspective, the alias is simply wrong because the method returns not only prime factors of the receiver but also their multiplicities -- i.e. the prime division of the receiver.
For me, 200.prime_factors sometimes looks to return (or yield) [2, 2, 2, 5, 5] as MATLAB does.

Mame, do you have any concrete examples which support your expectation to the return value? Or any suggestions from native English speakers or mathematicians?

Also available in: Atom PDF