Jump to content

Fortunate numbers: Difference between revisions

m
Update J to be a complete program
(Add J implementation)
m (Update J to be a complete program)
Line 278:
 
=={{header|J}}==
<syntaxhighlight lang="j"> fortunate =: p -~ 4 p: 2 + p =. */ @: p: @ i. @ x:</syntaxhighlight>
echo 'Unique fortunate numbers'
echo _10 [\ 50 {. /:~ ~. fortunate"0 >: i. 75</syntaxhighlight>
{{out}}
<pre>
NB. Unique fortunate numbers
_10 [\ 50 {. /:~ ~. fortunate"0 >: i. 75
3 5 7 13 17 19 23 37 47 59
61 67 71 79 89 101 103 107 109 127
2

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.