Talk:Prime decomposition: Difference between revisions

 
(7 intermediate revisions by 6 users not shown)
Line 4:
It prints out the factors seperated by * to stdout, In the context of unix, where everything is a text stream this counts as a collection.
Why do you think it's unconventional, If you haven't used libgmp it may look strange.
 
==C==
This method seems to be incorrect. E.g. it does not find the decomposition for 2^41 - 1 == 13367 * 164511353. Can someone confirm this?
--[[User:Renfield|Renfield]] ([[User talk:Renfield|talk]]) 12:18, 18 June 2019 (UTC)
 
==Java==
Line 40 ⟶ 44:
 
To me, both requirements should be dropped (bignums and the use of "growing arrays" should be other tasks) --[[User:ShinTakezou|ShinTakezou]] 14:09, 7 April 2009 (UTC)
 
I also think that bignum/growing array requirements should be dropped. At the very least, the title of the page should indicate that big numbers are part of the challenge. --[[User:Showell|Showell]] 07:33, 5 January 2012 (UTC)
:Agreed. The task is asking far too much. Integer factorization is one of those basic programs one learns early, in any language. But if bignums are required, it's entirely another matter: first one needs a library (relatively hard), then one needs a good factorization algorithm (very hard). [[User:Eoraptor|Eoraptor]] ([[User talk:Eoraptor|talk]]) 23:28, 17 December 2017 (UTC)
 
== NZMATH ==
Line 70 ⟶ 77:
 
I'm reverting the last change of array size from 8 to 30, since it's mathematically impossible to have more (or fewer than) 8 numbers after each run. If you disagree because some diagnostic software says other wise, show me where it will fail. --[[User:Ledrug|Ledrug]] 20:59, 7 September 2011 (UTC)
 
: The program fails because it crashes and dumps core! However, I fixed it wrong and made the size too large: it only needs to be 9, not 30.
 
: <lang c> for (i = 1, q = p; i <= 30; i++, q += p) {
if (!(b[n] = bit_pos[q % 30])) continue;
b[n] = ~b[n];
shift[n++] = q / 30;
}</lang>
 
: I missed that bit_pos[] has only 8 nonzero elements. After this loop fills b[0] to b[7], it continues to assign b[8] = 0, because the assignment is before the <code>continue</code> statement. Therefore, program must declare array b[9] to hold elements b[0] to b[8]. --[[User:Kernigh|Kernigh]] 22:29, 7 September 2011 (UTC)
:: Ok. Don't edit it yet though, I'll modify that part of the logic soon. --[[User:Ledrug|Ledrug]] 22:32, 7 September 2011 (UTC)
 
== Factor missing from 15 November 2001 to 23 March 2012 ==
 
An anonymous user [http://rosettacode.org/mw/index.php?title=Prime_decomposition&diff=next&oldid=125923 accidentally deleted the Factor example] at '''15 November 2001'''. Rosetta Code never caught this mistake and never restored the deleted code. Nickolas [http://rosettacode.org/mw/index.php?title=Prime_decomposition&diff=134165&oldid=132999 contributed a new Factor example] at '''23 March 2012'''. --[[User:Kernigh|Kernigh]] 15:03, 23 March 2012 (UTC)
 
: '''2001'''? &nbsp; I thought ''Rosetta Code'' was inaugurated in '''2007'''. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 13:37, 16 October 2013 (UTC)
 
== Javascript ==
 
Javascript implementation without libraries fails with 100 as an argument. It decomposes to 2,2,25
Anonymous user