Pan base non-primes: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|J}}: Works correctly but showing wrong count.) |
m (→{{header|J}}) |
||
Line 52: | Line 52: | ||
=={{header|J}}== |
=={{header|J}}== |
||
{{improve|J|Probably not doing anything wrong but there are 377 (378 if you include 1) pan-base non-primes up to 1000. 63 (64) is just the odd count}} |
|||
Implementation:<lang J>pbnp=: {{ if. 10 > y do. -.1 p: y return. end. |
Implementation:<lang J>pbnp=: {{ if. 10 > y do. -.1 p: y return. end. |
||
digits=. 10 #.inv y |
digits=. 10 #.inv y |
||
Line 61: | Line 60: | ||
20{.(#~ 2&|)1+I.pbnp 1+i.1e3 NB. first 20 odd pan based non primes |
20{.(#~ 2&|)1+I.pbnp 1+i.1e3 NB. first 20 odd pan based non primes |
||
1 9 33 39 55 63 69 77 93 99 121 143 165 169 187 231 253 273 275 297 |
1 9 33 39 55 63 69 77 93 99 121 143 165 169 187 231 253 273 275 297 |
||
# |
#1+I.pbnp 1+i.1e3 NB. number of pan based non primes up to 1000 |
||
378 |
|||
#(#~ 2&|)1+I.pbnp 1+i.1e3 NB. number of odd pan based non primes up to 1000 |
|||
64 |
64 |
||
100*(+/%#)2|1+I.pbnp 1+i.1e3 NB. percent odd pan based non primes up to 1000 |
100*(+/%#)2|1+I.pbnp 1+i.1e3 NB. percent odd pan based non primes up to 1000 |