Find largest left truncatable prime in a given base: Difference between revisions

Content added Content deleted
mNo edit summary
Line 246:
 
=={{header|J}}==
 
I'm fairly sure this is correct but it sure has long run time for base 12.
<lang J>Filter=: (#~`)(`:6)
 
f=: 3 : 0
BASE=. y
primes=. (1&p:)Filter
DIGITS=. }. i. x: BASE
R=. 0
A=. ,0
while. #A do.
R=. >: R
B=. A
A=. primes , A +/ BASE #. (_,R) {. ,. DIGITS
end.
>./ B
)
 
f N NB. where N is the base.
</lang>
 
=={{header|Java}}==