Discussion:
Prime Factor Coding Challenge
(too old to reply)
bluebeard
2008-08-13 01:40:17 UTC
Permalink
Hi, I must lost zero but to not carry out successful.. :/ <img src="Loading Image...">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="Loading Image...">


Ekran Al?nt?s?2.JPG:
http://forums.ni.com/attachments/ni/170/348858/1/Ekran Al?nt?s?2.JPG
altenbach
2008-08-13 05:40:20 UTC
Permalink
bluebeard wrote:Hi, I must lost zero but to not carry out successful.. :/&nbsp;


If you want to remove zeroes from a 1D array, you could do something like in the&nbsp;<a href="http://forums.ni.com/attachments/ni/170/116060/3/RemoveZeroes_1D.vi" target="_blank">this VI</a>.
&nbsp;
(see also&nbsp;<a href="http://forums.ni.com/ni/board/message?board.id=170&amp;view=by_date_ascending&amp;message.id=116060#M116060" target="_blank">this old discussion</a>)
bsquared
2008-08-13 14:40:07 UTC
Permalink
Or, use a separate counter to keep track of the count of primes you've found so far, and use that to add them to the output array with no gaps of zeros.&nbsp; Then reshape array at the end&nbsp;to cut off all the trailing zeros.&nbsp;
Continue reading on narkive:
Loading...