Post History
J, 50 bytes {{({~[:y&(i.&1@:=)[:>+/&.>),{@(,&<)~p:i.p:^:_1 y}} Try it online! A nasty DD solution. {{({~[:y&(i.&1@:=)[:>+/&.>),{@(,&<)~p:i.p:...
Answer
#1: Initial revision
# [J](https://jsoftware.com/#/), 50 bytes ```J {{({~[:y&(i.&1@:=)[:>+/&.>),{@(,&<)~p:i.p:^:_1 y}} ``` [Try it online!](https://tio.run/##y/r/P83WyljBSkFdo7ou2qpSTSNTT83QwcpWM9rKTltfTc9OU6faQUNHzUazrsAqU6/AKs4q3lChUh2oUSE1MTlDwUTBTMHIRMHQyEDB0MDAAAA) A nasty DD solution. ``` {{({~[:y&(i.&1@:=)[:>+/&.>),{@(,&<)~p:i.p:^:_1 y}} p:i.p:^:_1 NB. primes less than y {@(,&<) NB. cartesian product, 2d array of boxed pairs , NB. flatten boxes ({~[:y&(i.&1@:=)[:>+/&.>) NB. monadic hook [:>+/&.> NB. sum each pair and unbox [:y&(i.&1@:=) NB. first occurrence of y in list of sums {~ NB. flip arguments to index boxed pairs ```