j

iw: 20210504t040000
lu: 20221111t165054

I've decided to continue learning J. I had months ago heard about it somwhere, then forgot or got up to other stuff, among other excuses. Installation via instructions provided in the wiki to access newest version. There are 2 IDEs, it runs on Android, ARM, iOS, GNU/Linux, Windows; there's a REPL, there's a JS-based one for the web, if you want to immediately try it without commitment. Resources include:

Alternative attempts will be numbered in comments. Anything affixed a fixme is gay, incomplete, and or wrong.




NB. pe001
+/@~.@(#~(+/@(0&=)@(3 5&|)@,:]))i.1e3

NB. pe002 fixme
x:+/@(0&=@(2&|)#])@(4e6&>#])(1:`((],+/@(_2&{.))@$:@<:)@.*)1e2e

NB. pe003 fixme
>./q:600851475143

NB. pe004
(>./@(((*/@(=|.)@":)"0)#])@,@(]*/]))1e2+i.9e2

NB. pe012 fixme
div1=:13 :'1{(0=q-<.q)#q=.y%(1+i.y-1)' NB. 1
div2=:13 :'(0=q-<.q)#q=.y%(2,>:@+:@i.@<.@(%&2))y'NB. 2

NB. pe005
<./((0&=@(+/"1@:((>:i.20)&|)"0))#])(*/}.~.0{"1(q:>:i.20))*>:i.1e2 NB. num should contain prime factors at least once

NB. pe006
(*:@:(+/)-+/@:*:)@:>:i.1e2

NB. pe007 fixme?
p:1e4

NB. pe008
(>./@:((13&(*/)\)@"."0))'73167176531330624919225119674426574742355349194934969835203127745...'

NB. pe013
":!.11+/q=:... NB. 1 no fucking clue what the fuck q was
((i.10)&{ @ ": @ x: @ (+/))NB. 2 copy list, then `xclip -i | tr \\n \  | xclip` and paste in

NB. pe014
q=:3 :0 NB. 1
if.1&<@:{:y
do.((],(((-:@:[*0=2&|)+(>:@:(3&*)@:[*1=2&|))@:{:)))y
else.]y end.
)
w=:(#@:~.@:(q^:_))"0
e=:w i.1e6
((>./e)=e)#i.1e6
((((([)`((((-:)`([:>:3&*)@.(2&|))@:(0&{)),([:>:(1&{)))@.((1&=)@:(0&{)))^:_1)@:(,&0))"0)NB. 2

NB. pe016
+/("."0@":)x:(2^1e3)

NB. pe009 fixme
q=:3 :0
a=.<:y+i.(1e3-y)
s=.0=(a*(a-1e3))+(y*(y-1e3))+(a*y)-5e5
if.1=+./s do.(s#a),y end.
)
q(1&|.)^:(i.1e3)(i.1e3)

NB. pe029
#~.,(q&^)"0 q=:>:>:i.99

NB. pe030
<:+/((((+/@:(^&5)@:>@:((,.&.":)&.>))=[)"0) i.1e6)#(i.1e6)

NB. pe034
(3&-)+/((((+/@:!@:>@:((,.&.":)&.>))=[)"0)i.1e6)#(i.1e6)

NB. pe035
+/@:(*/@:(1&p:)@:~.@:(((1&|.)&.":)^:(>:i.5))"0)((-.@:(+:/@:(0&=)@:>@:((,.&.":)&.>))"0)#])p:i.(_1 p:1e6)NB. 0s result in repeating lesser primes

NB. pe040
q=:":@:,@:((":)"0)i.1e6 NB. strings of variable lens not easily concd

NB. pe123
((((<:@:p:@:<:^[)+(>:@:p:@:<:^[))|~*:@:p:@:<:)"0)>:i.1e5 NB. NaN error?
(((<:@:p:@:<:&^[)+(>:@:p:@:<:&^[)|~*:@:p:@:<:)"0)>:i.1e3 NB. yields 2 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 ... Bolano would be happy, ffs
((((<:@:p:@:<:^[)+(>:@:p:@:<:^[))|~*:@:p:@:<:)"0)>:i.1e5 NB. this should be the answer, but after the first 9 it's all 0s
<./@:(#&(>:@:(_1 p:1e6))q=:(1e10&<@:(((<:@:p:@:<:^[)+(>:@:p:@:<:^[))|~*:@:p:@:<:)@:x:@:>:@:i.)(_1 p:1e6)

NB. pe056
+/@:>@:((,.&.":)&.>)x:!.0(4^12)
([,:)^:(i.[) (i.5)
(([,:)^:(i.[)(i.5)) *"2 (i.5)...
>:>./,+/"1@(,.&.":)"0,.@,@x:@((((#,#)$])^])@:>:@i.)1e2 NB. 2

NB. pe015
(*/21&+i.20)%(*/>:i.20)

NB. pe759 fixme
q=:(((((2+%)*$:)@-:@<:)+]`(+:@$:@-:))@.2&|)`1:@.1&=
7&+1e9|(+/@:*:q@:>:@i.)(x:1e16)

NB. pe100
p100=:3 :0 NB. 1; if inequality born from the ratio unmet, searches for increments either head or tail fixme stack error
q=.+:@(*<:)@{.y
w=.(*<:)@+/y
if.q=w do.<"0@(],+/)y
elseif.q>w do.p100((0 1)+y)
else.p100((1 0)+y) end.
)
q=:(+:@(*<:)@{.) NB. 2 stack error
w=:((*<:)@+/)
a=:((a@((1 0)+])`(a@((0 1)+]))@.(q>w))`(<"0@(],+/))@.(q=w))

q=:{{(i.@<.@-:y)&{@:(|.,.])@:>:@i.y}}"0 NB. 3 out of memory
w=:{{{.@((1r2&=)#(y&*@1:))(%/)@(*/)@(,:<:)@({.,+/)"1 y}}
(((0&<)#])@,@:(w@q)) 1e12&+@>:@i.1e2 
q=:{{ NB. 3 stack error
x=.x:x
if.1r2=(x%(x+y))*((<:x)%(<:x+y))do.
x
elseif.x<y do.
(x+y-1)q 2
else.
(x-1)q(y+1)
end.
}}
1e12 q 2


NB. ((>:x)$:y)`(           )@.(0.5&>@{{x(((*<:)@[)%((*<:)@]))y}})
w=:{{if.0.5&<q=.x:x(((*<:)@[)%((*<:)@]))y do.(>:x)w y elseif.0.5&<q do. x w(>:y)elseif.0.5&=q do.x,y end.}}

w=:{{if.0.5&<q=.x:x(((*<:)@[)%((*<:)@]))y do.(>:x)w y elseif.0.5&<q do. x w(>:y)elseif.0.5&=q do.x,y end.}}
(4 :'[,]`[$:(>:@])@.(0.5&>q)`(>:@[)$:]@.(0.5&<q=:x:([(((*<:)@[)%((*<:)@]))]))') NB. noun result req'd

{{)d x,y`x$:(>:@y)@.(0.5&>q)`(>:@x)$:y@.(0.5&<)q=:x:(x(((*<:)@[)%((*<:)@]))y)}}

{{ if.0.5&<q=:x:(x(((*<:)@[)%((*<:)@]))y)do.(>:x)$:y elseif.0.5&>q do.x$:(>:y)else.x,y end.}}
x,y`x$:(>:@y)@.(0.5&>q)`(>:@x)$:y@.(0.5&<)q=:x:(x(((*<:)@[)%((*<:)@]))y)}}
w=:{{ if.0.5&<q=:x:(x(((*<:)@[)%((*<:)@]))y)do.(>:x)w y elseif.0.5&>q do.x w(>:y)else.x,y end.}}

w=:{{ if.0.5<q=:x:x(%&(*<:))y do.(>:x)$: y elseif.0.5>q do.x $:(>:y)else.x,y end.}}





NB. pe044
p=:-:@(3&*@*:-])"0
P=:(0:`{.@.(>.=<.))@{.@({:@:>@p.@(_1&*@+:,_1:,3:))"0
q=:}:@(],.(>:@i.))"0
(<./@(-/"1)@((*./@:*)"1#])@(P@(+/,-/)"1@:p@q)) NB. slow

NB. pe045
t=:-:@(*:+])"0
P=:(_.&*`{.@.(>.=<.))@{.@({:@:>@p.@(_1&*@+:,_1:,3:))"0
H=:(_.&*`{.@.(>.=<.))@{.@({:@:>@p.@(_1&*@],_1:,2:))"0
{.@}.@~.@:(0:`]@.(0&<@H*.0&<@P)@t)286&+i.1e5

NB. pe046
(12&=@#@~.@,@:q:)
(_.&*`]@.(12&=)@#@~.@,@:q:@:((i.@4:)+]))
~.@,@:((0:`]@.(12&=)@#@~.@,@:q:@:((i.@4:)+]))"0)
((((12&=)@#@:q:@((i.@4:)+]))"0)#])>:i.1e3

NB. pe036
ip=:*./@:(({.={:)"1@:{~((,.-@>:)@i.@<.@-:@#)) NB. is palindromic, lol, you suck, nigga
NB. 04+/@~."1@:(0:`(0:`]@.(ip@#:))@.(ip@(,.&.":))"0) i.1e6
1e10|+/@([:(]^])([:>:i.))@x:1e3

NB. pe049 fixme
q=:(]#~999&<)q N.????q=:p:(>:i._1 p:9)

NB. pe057
+/({.>{:)"1#@":"0@x:(({:,0:)+(+/))^:(i.1e3)(x:1 1)

NB. pe053
(+/@,@:(1e6&<@((!@{.)%((!@{:)*(!@({.-{:))))"1@(],.>:@i.)"0))>:i.1e2

NB. pe055
+/@:-.50(q=:{{(((<:x)&q@])`0:@.(0=x))`1:@.(*/@(=|.)@":)@(+(|.&.":))x:y}}"0)i.1e4

NB. pe063
+/(3 :'(+/@(((10^(<:y))&<:)*.((10^y)&>))@((>:i.9)^]))y')"0 i.25

NB. pe778
q=:4 :'x((9+1e9)&|@((('' ''&~:)#])&.":)@(]`(_1&{&.":)@.(9&<)"0@(*&("."0@":))))y'
vari=:[{."_1]A.~#@:]([(]*i.@:%)&!-)[ NB. https://code.jsoftware.com/wiki/Phrases/Sets
w=:4 :'x+/@(q/"1@~.@vari(,])@(>:@i.))y' NB. works for small x y domain error on vari---find/devise more efficient gen, slow for 7 w 5

NB. pe040
*/"."0((10^i.6)&{@(' '&~:#])@":)i.10^(($:@>:)`]@.(6&<:@#@":@(+/)@:(((10&^)-(10&^@<:))*])@x:))1 NB. log10 of integers to generate for at least 1e6 digits

NB. pe041
>./@(((*./@:((>:@i.@#)e.("."0)))@":"0)#])p:i.(_1 p:2e9)

NB. pe076
p=:3 :0"0
if.0=y do.1:y
elseif.0>y do.0:y
else.
NB. (({.+i.@>:@-~/)@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)
NB. +/@:p/(((*&_1@>:@i.@{.),(>:@i.@{:))@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)y
NB. (+/@:p@:((*&_1@>:@i.@{.),(>:@i.@{:))@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)y

for_k.(((*&_1@>:@i.@{.),(>:@i.@{:))@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)y do.
(p(y&-@-:@    3*k^2-k   ))*_1^(k+1)

+/@:(((p@(-&y)@-:@(*(<:@*&3)))*(_1:^>:))"0@((*&_1@>:@i.@{.),(>:@i.@{:))@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)y 
end.
end.
)

(((+/@:p@:((*&_1@>:@i.@{.),(>:@i.@{:))@(>.@%&_6@<:,<.@%&6@>:)@%:@>:@*&24)`0:)@.(0&>))`1:@.(0&=)
(#@~.@("."0@":@,))q NB. min amount of digits
(i.9)(]-.~-.)((~.@("."0@":@,))q)NB. missing numbers

NB. pe079
q=:NB. xp -o|tr \\n \ |xp

NB. pe193
8&+@(+/)@:((+./@:=&0@(|~((*:@p:@i.@(_1&p:)@(_4&p:)@%:))))"0)11&+i.2^50 NB. 1 limit error don't look up primes for each number, ffs
((*:@p:@i.@(_1&p:)@(_4&p:))2^25)([:<:[:#[:~.[:,[*(>:@i.@<.@(]%[)))2^50 NB. 2 limit error aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
{{for_q.(*:@p:@i.@(_1&p:)@(_4&p:)@%:)2^50 do.w=:~.@(w&,)@(q&*)@>:@i.@<.2^50%q end.}}w=:0 NB. 3 ???
{{for_q.(*:@p:@i.@(_1&p:)@(_4&p:)@%:)2^50 do.w=:w,((q&*)@>:@i.@<.2^50%q)end.}}w=:0 NB.4 ???
(#@~.@,@{{(((>:@i.@<.(y&%))*])@*:@p:@i.@(_1&p:)@(_4&p:)@%:)y}})2^50 NB. 5 limit error

NB. pe065
(+/@("."0@>@{.@(<;._1)@('r'&,)@":))@+&2@(3 :'(((1:%({.+($:@}.)))`(x:@%))@.(1:=#))y')(99&{.(1,([,1,1,])/+:@>:@i.4e1)) NB.1
(+/@("."0@>@{.@(<;._1)@('r'&,)@":))(+%)/x:(100&{.(2,1,([,1,1,])/+:@>:@i.4e1)) NB. 2

NB. pe796 fixme
q=:(!@{.%!@{:*!@-/)"1 NB. binomial coefficient    (x: q 54 13) * w -: 4  NB. exactly 4 suits
(]i.(>./))(q (54,.(13+i.41)))*(w0*42%(41+ -i.41)) NB. amount of combinations * chance for full suit + extra cards      index of greatest number, that is, with highest probability; 15
w0=:x:*/%/"1(13 2$ 52 54 12 53 11 52 10 51 9 50 8 49 7 48 6 47 5 46 4 45 3 44 2 43 1 42) NB. P 13 of same suit sequentially
(q 54,c) * (w0*42%(42-c)) NB. solve c for maximum, somehow

NB. pe074
([:+/60&=@{{$:`#@.([:+./{.E.}.)@(q,])y}}@(q=:[:+/ x:@!@"."0@":@{.)"0)i.1e6

NB. pe043
([:+/".@(([:(7#0)&-:|~&(p:i.7)@([:}.3".\":))#])"1)@(i.@!@#A.i.@#C.])'0123456789'

NB. pe698 fixme
is123=:{{)m(  "."0@":)y}} 
([:+/((1,2,3)&e.@])@"."0@":)1112            (((1:,2:,3:)e.])@"."0@":) 1112
   (3 3 3 3 3 #: i.30)

NB. pe254 fixme
f=:([:+/!@"."0@":)
s=:([:+/"."0@":)

NB. pe080 fixme
("."0@":x:!.0@*&1e100@%:)1e2

NB. pe064 fixme
(([:+/(2&|)@{{$:`(<:@#)@.({.e.}.)@((1&|@%@{.),])y}}"0@(~:&0#])@(1&|)@:%:))>:i.1e4 NB. 1 fails ultimately bc. of comparison tolerances
(([:+/(2&|)@{{$:`(<:@#)@.([:+./{.(1e_3(1 :'|@-<:!.0 m*>.&|'))}.)@((1&|@%@{.),])y}}"0@(~:&0#])@(1&|)@:%:))>:i.1e4 NB. 2 https://code.jsoftware.com/wiki/Essays/Tolerant_Comparison#Models
(([:+/(2&|)@{{$:`(<:@#)@.([:+./{.(1e_4(1 :'|@-<:!.0 m*>.&|'))}.)@((1&|@%@{.),])y}}"0@((0&<@(1&|))#])@:%:))>:i.1e4 NB. 3 ???

NB. pe487 fixme
+/(p:({.+i.@{:)({.,-~/)(p:^:_1)4 p:(],2e3&+)2e9)|1e4([:+/[:+/]\@:>:@i.@]^[)1e12 NB. 1
+/(p:({.+i.@{:)({.,-~/)(p:^:_1)4 p:(],2e3&+)2e9)|([:+/@:((>:@i.@-@#)*])>:@i.@{.^{:)1e12 1e4 NB. 2 big nombr make memori go kthxbai

NB. pe160 fixme
({{((-@>:@i._5)&{`($:@}:))@.(=&'0'@{:)y}}@":@x:@!)1e15
{{(-@>:@i._5)&{`($:@}:)@.(=&'0'@{:)y}}@":@!x:!.0(1e15)

NB. pe050
({.@((>./@/:@{:@|:){])@(1&p:@{.#])@(1e6&>@{.#])@,@([:(+/,([:+/#@>&0))\"1($$(([:,<:/~@(>:@i.@#))*,))@((1&|.)^:(i.@#))@p:@i.@(_4&p:)))1e6

NB. pe120
(>:i.1e3)([:+/([:>./(*:@])|((<:@]^[)+(>:@]^[)))"1 0)(3&+i.998x)

NB. pe119
q=:{{if.1<z=.([:+/"."0@":)y do.+./y=z^(>:@i.(<.z^.y))else.0:y end.}}"0
{{if.q y do.if.x=1 do. y return.else.(<:x)$:(>:y)end.else.x$:>:y end.}}10
([ $: >:@])`((<:@[ $: >:@])`]@.(1:=[))@.(q)
 2    (3 :'([ $: >:@])`((<:@[ $: >:@])`]@.(1:=[))@.(q)')10

NB. pe235
0j12":>{:p.6e11,(9e2-3*])2+i.4999 NB. obscenely heavy
(I.1&=(_5e3 5e3)I.((6e11,(9e2-3*])2+i.4999)p.z))#z=:1.002(1e6){{(x<.y)+(i.1+m)*(m%~|x-y)}}1.0024 NB. nah
q=:((6e11,(9e2-3*])2+i.4999)&p.)
rbm=:{{ NB. root bisection method
N=.0
M=.1e9 NB. max iterations
t=.1e_14 NB. tolerance
a=.1.0 NB. lower bound
b=.1.1 NB. upper bound
while.N<M do.
c=.-:a+b
if.(0=Q=.u c)+.(t>(-:b-a))do.0j12":c return.end.
N=.1+N
if.Q((=&*) u)a do.a=.c else.b=.c end.
end.
0:y
}}
q rbm ''

NB. pe802 fixme
q=:(((2^~{.)-{.-2^~{:),(1p1-{:+[:+:{.*{:))
F=:{{
N=.0
w=.y
whilst.w~:y do.
w=.q w
N=.1+N
end.
N
}}

NB. pe145 fixme
((([:*./e.&'13579')@":)"0@((0~:])#])@,@:((+(((('0'~:{.)#])@|.)&.":))"0))

NB. pe059 fixme
e=:#q=:".1!:1 <'/tmp/p059_cipher.txt'
{{for_w.a.i.(((26^3),3)$])shell'zsh -c "printf %s {a..z}{a..z}{a..z}"'do.
r=.(e$w)(23 b.)q
if.+./32=r do.NB.(([:*./31&<)*.([:*./128&>))r
((w{a.),CRLF,(r{a.),CRLF,'-----------------------------------',CRLF) fappend '/tmp/z'
end.
end.
}}''

NB. pe089
q=:];._1 LF,shell'cat p089_roman.txt'
(('IVXLCDM'e.~])#])

NB. pe011
x:>./(([:>./[:([:>./4*/\])(],|:)),([:>./[:([:>./4*/\])/.(],|:)))".;._1 LF,shell'xclip -o'

NB. pe010 fixme?
+/p:i._1 p:2e6

NB. pe098 fixme
([:%:[:*/+/,(+/-])) 5 5 6

NB. pe033 fixme
(((]%[)=(((([:-.+./&|:@:="1 0)#])%(([:-.+./&|:@:="0 1)#[))&("."0@":))) #])/"1 ((([:+./'0'&~:@{:@":"0)*.(~:/)"1)#])"1 >,(([:<[,])"0 0/])1e1&+i.1e2-1e1

NB. pe466 fixme
64([:#[:~.[:,*/&(>:@i.))1e16 NB. 1

NB. aoc2101
(+/@(2({.<{:)\]))

(+/@(2({.<{:)\]@3(+/)\]))

NB. aoc2102
q=:w=:0
f=:3 :'q=:q+y'
u=:3 :'w=:w-y'
d=:3 :'w=:w+y'

q=:w=:e=:0
f=:3 :0
q=:q+y
w=:w+(e*y)
)
u=:3 :'e=:e-y'
d=:3 :'e=:e+y'

NB. aoc2103
*/#.(|:@(],.-.))(500&<@(+/)@((":)^:_1)@,.)"1|:1e3 12 NB.$(xclip -o | tr -d \[:space:\])

g=:|:@(500&<:@(+/)@((":)^:_1)@,.)"1|:1e3 12$ a
e=:|:@-.@(500&>@(+/)@((":)^:_1)@,.)"1|:1e3 12$ a

NB.g(((0&{ @ [)=@ 0&{)"1#]){1e3 12 NB.$(xclip -o | tr -d \[:space:\])
NB.  ^---consequetive number of g  ???

NB. aoc2104
boards=:(((5&%~@#),5:,5:)$])q

update=:(*(numFromQ&~:))boards

(17 b.)/"1 @ (23 b.)/"1 (boardNum{boards)
(17 b.)/"1 @ (23 b.)/"1 (|:boardNum{boards)

NB. arbitrary length, square sudoku solver sudoku
Q=:i.y
NB. get a cell's corresponding face's, row;s, and column's indicies, boxed, in 3 4 shape
NB. frc=:3 :'(frcs&((2&=@(+/)@:([=]))"1 1 1#[))y'
NB. indices of each of the y^2 faces (;Q;Q), rows (;;QQ), and columns (QQ;;); all indices boxed and stacked as rows; formation of frcs: contains Q twice; cells 1 and 4 cell differ; only cells 2 or 4 len 3
NB. frcs=:(((((<Q)-:1&{)+.((<Q)-:3&{))*.(0&{~:3&{)*.(1&{~:2&{))"1#])@(((2([+*)y)&=@(+/@:(#@>)))"1#])@~.(4([{."_1]A.~#@:]([(]*i.@:%)&!-)[)(((;/@(2&#)),<,<)Q))
NB.  ON THE CHEAP
frc=:3 :'((q;Q;e;Q),(q;w;Q;Q),:(Q;Q;e;r))"_''q w e r''=.y'
NB. hypercube indices using https://code.jsoftware.com/wiki/Phrases/Sets
i=:~.(4([{."_1]A.~#@:]([(]*i.@:%)&!-)[)(;/4&#Q))
NB. replace all 0s with could-be numbers
rz=:3 :'for_q.i do.if.0=>(<q){y do.y=.(<is/(mn(<"1 frc q){y))(<q)}y end.end.'
NB. rz=:3 :'for_q.i do.if.0=>(<q){y do. if.1=#e=.is/(mn(F=.<"1 frc q){y) do. y=.(<e)(<q)}y=.((-.&e&.>)F{y)F}y else. y=.(<e)(<q)}y end.end.end.'
NB. renew a grid's could-be numbers
rg=:{{if.((*/@$)-:(+/@#@;))y do.y return.end.for_q.i do.if.1<#>(<q){y do.e=.is/(mn(<"1 frc q){y)if.1=#e do.y=.rg(<e)(<q)}y else.y=.(<e)(<q)}y end.end.end.}}
NB. solv=:3 :'it^:_@rz y'
solv=:3 :'it^:_@rg@rz y'
NB. if empty (0-containing), amend with the intersection of the missing numbers of its nines; elif possibilities (could-be numbers), for each its nines, amend w/ its one unique possibility, having removed self, if unique(, else, treat as if empty)
it=:{{)m
if.81-:+/#;y do.y return.end.

for_q.i do.NB. all
NB. for_q.(({~@?~@#){])i do. NB. all, random order
NB. for_q.(((1&<&#@>@{&y@<)"1)#])i do.NB. non-exact
NB. for_q.(({~@?~@#){])(((1&<&#@>@{&y@<)"1)#])i do.NB. non-exact, random order
NB. for_q.(({~@?~@#){])@(((1<#)@>@{&y@<)#])"1 i do.NB. fixme how to remove empty boxes? NB. if.(4#a:)-:q do. continue. end.NB. lol, no
NB. for_q.(/:(#@>@({&y)@<)"1)(((1&<&#@>@{&y@<)"1)#])i do.NB. all cells non-exact by increasing possibilities (as per this iteration)... SLIGHT improvement

if.1<#w=.>(<q){y do.
NB. if.1=#e=.(0&~:#])@,@~.@(w((-.@([e."1]))#[)(~.@;@(((<w)~:])#])@((1<#@>)#])@:,"2@((F=.<"1 frc q){])))y do. NB. NO
NB. if.1=#e=.(0&~:#])@,@~.@(w((-.@([e."1]))#[)(~.@;@((((<w)&~:)#])`]@.(1&<@(+/)@((<w)&=)))@((1<#@>)#])@:,"2@((F=.<"1 frc q){])))y do. NB. NO
NB. if.1=#e=.~.@((w,0)((-.@([e.]))#[)~.@,@(;@((((<w)&~:)#])`]@.(1&<@(+/)@((<w)&=)))@((1<#@>)#])@:,"2@((F=.<"1 frc q){])))y do. NB. better?
NB. if.1=#e=.((0&~:#])@,@~.@(((w)((-.@([e.]))#[)~.@,@;@(((<w)&~:)#])`]@.(1&<@(+/)@((<w)&=)))@((1<#@>)#])@:,"2@((F=.<"1 frc q){])))y do. NB. NO but almost?
NB. if.1=#e=.((0&~:#])@~.@,@(((1:=#)#])@(w((-.@([e.]))#[)~.@;@(((<w)&~:)#])`]@.(1&<@(+/)@((<w)&=)))@((1<#@>)#])@:,"2@((F=.<"1 frc q){])))y do. NB. NO
NB. if.1=#e=.((0&~:#])@~.@,@(((1:=#)#])@(w((-.@((i.@#@])e.((=i.1:)"0 1)))#])])@((1<#@>)#])@:,"2@((F=.<"1 frc q){])))y do. NB. better?
NB. if.1=#e=.((0&~:#])@~.@,@((w((-.@([e.]))#[)~.@w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){])))y do.NB. NO for each frc, remove w once, check if w has one unique
NB. if.1=#e=.(0&~:#])@~.@,@is/@:((w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y do. NB. YES..?
NB. if.1=#e=.((0&<#]) @~.@,@((w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){])))y do. NB. NO
NB. if.1=#e=.([:(is&(,@;))/[:(~:&a:#])<"1@(w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y do.NB. fails if all empty, hence impossible to apply is/
NB. if.1=#e=.([:(is&(,@;))/<"1@(w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y do. NB. ALMOST?
NB. if.1=#e=.([:(is&(,@;))/<"1@(w(-.@([e.])#[)(w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])]))@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y do. NB. NO
NB. if.1=#e=.([:(is&(,@;))/[:(a:&~:#])<"1@(w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y do. NB. YES?

NB. e=.([:(a:&~:#])<"1@(w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y
NB. e=.([:,[:((is&(,@;))/)  [: (a:&~:#]) <"1@(w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y
NB. e=.([:(a:&~:#])<"1@(w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y
NB. e=.([:,[:(is&(,@;))/)`(w"_)@.(''&=)e

NB. if.-.(''-:(;e)) do.e=.([:,[:(is&(,@;))/)e end.
NB. e=.;(is&(,@;))e
NB. e=.([:,[:(is&(,@;))/[:(a:&~:#])<"1@(w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y
NB. [:(is&(,@;))/
NB. if.''~:e do.
if.1=#e=.,(>)`((is&(,@;))/)@.(1<#) ([:(a:&~:#])<"1@(w(-.@([e.])#[)w((-.@((i.@#@])e.(([(=i.1:)])"0 1)))#])])@;@((1<#@>)#])@:,"2@((F=.<"1 frc q){]))y do.

NB. y=.q rm(<e)(<q)}y
NB. y=.rg(<e)(<q)}y
NB. y=.(q;e)rn(<e)(<q)}y
y=.rg(<e)(<q)}((-.&e&.>)F{y)F}y NB. fixme exclude solved cell from fcr to forgo 2. amend?

NB. elseif.e(-:&(/:{([,])))w do.
NB. y=.(<is/(mn F{y))(<q)}y NB. single value missing from whole: exclude numbers from all regions sans self, hence impossible to apply is/
NB. y=.q(is/(<@mn@(<"1@F&{frc@[){])`<@[`])}y

else.
y=.(<is/(mn F{y))(<q)}y
NB. if.1=#e=.is/(mn F{y)do.y=.rg(<e)(<q)}((-.&e&.>)F{y)F}y elseif.1<#e do.y=.rg(<e)(<q)}y end.
end.
end.
end.
}}
''
}}
c 3