After posting that last message, I think I figured
out how to write something more closely analogous to fpp:
clos=: ~.@((= <./)@:|@:- # ]) ,
nea1=: 3 >. 4&(p:"0)^:(0&p:)("0)@(2&>.)
pow1=: >:@[EMAIL PROTECTED]@>.@(3&^.)@>:
mpr=: <./@:([EMAIL PROTECTED]:)
mopr2=:([EMAIL PROTECTED] nea1,([EMAIL PROTECTED] [EMAIL PROTECTED]) ^&x:
pow1)"0
;/,"0 mopr2 i. 10 10
+-+--+--+--+--+--+--+--+--+---+
|3|11|23|31|41|53|61|71| 3| 97|
|3|11|23|31|41|53|61|71| 3| 97|
|3|13|23|37|43|53|67|73|83| 97|
|3|13|23|37|43|53|67|73|83| 97|
|5|17| 5|37|47|59|67|79|89| 97|
|5|17| 5|37|47|59|67|79|89| 97|
|7|17| 3|37|47|59|67|79|89| 97|
|7|17| 3|37|47|59|67|79|89| 97|
|3|19|29|41| 7|59|71|79|89|101|
|3|19|29|41| 7|59|71|79|89|101|
+-+--+--+--+--+--+--+--+--+---+
Basically: do not bother considering primes
smaller than y or a root of y -- only consider
the smallest prime not smaller than y, or
the root of y. The result is still the
smallest prime or prime root which corresponds
to a prime or prime power of one of these roots
which is nearest y.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm