Descending primes: Difference between revisions

→‎J: simplify, speedup 10 times
(Initial FutureBasic task solution added)
(→‎J: simplify, speedup 10 times)
Line 833:
 
=={{header|J}}==
Compare with [[Ascending_primes#J|Ascending primes]] (focusing on the computational details, rather than the presentation).
<syntaxhighlight lang="j"> NB. increase maximum output line length
9!:37 (512) 1} 9!:36 ''
 
(#~ 1&p:) (#: }. i. 512) 10&#.@# |. >: i. 9
Compare with [[Ascending_primes#J|Ascending primes]] (focusing on the computational details, rather than the presentation).
2 3 31 41 421 43 431 5 521 53 541 5431 61 631 641 6421 643 6521 653 7 71 73 7321 743 751 7541 75431 761 7621 76421 7643 764321 76541 76543 821 83 8431 8521 853 8543 863 8641 86531 865321 8731 8741 87421 8753 87541 8761 87631 87641 87643 876431 8764321 8765321 941 9421 9431 94321 9521 953 9631 9643 96431 97 971 9721 9743 975421 9754321 97651 97654321 983 98321 9851 98543 98621 98641 986543 9871 98731 9875321 987541 987631 98764321 98765431</syntaxhighlight>
 
<syntaxhighlight lang="j"> extend=: {{ y;y,L:0(1+each i.1-{:y)}}
($~ q:@$)(#~ 1 p: ])10#.&>([:~.@;extend each)^:# >:i.9
2 3 31 43 41 431 421 5 53 541 521 5431 61 653 643 641 631 6521 6421 7 73 71 761 751 743 7643 7621 7541 7321
76543 76541 76421 75431 764321 83 863 853 821 8761 8753 8741 8731 8641 8543 8521 8431 87643 87641 87631 87541 87421 86531 876431 865321 8765321 8764321 97 983
971 953 941 9871 9851 9743 9721 9643 9631 9521 9431 9421 98731 98641 98621 98543 98321 97651 96431 94321 987631 987541 986543 975421 9875321 9754321 98765431 98764321 97654321</syntaxhighlight>
 
=={{header|Java}}==
559

edits