[Question]
  [
2013 has the prime factorization `3*11*61`. 2014 has the prime factorization `2*19*53`. An interesting property regarding these factorizations is that there exist distinct primes in the factorizations of 2013 and 2014 that sum to the same number: `11+61=19+53=72`.
Write a program or function that takes as its input two positive integers greater than 1 and returns a truthy value if there exist a sum of selected prime factors of one number that is equal to a sum of selected prime factors in the second number, and a falsey value otherwise.
---
**Clarifications**
* More than two prime factors can be used. Not all of the prime factors of the number need to be used in the sum. It is not necessary for the number of primes used from the two numbers to be equal.
* Even if a prime is raised to some power greater than 1 in the factorization of a number, it can only be used once in the sum of primes for the number.
* 1 is not prime.
* Both input numbers will be less than `2^32-1`.
---
**Test cases**
```
5,6
    5=5
    6=2*3
    5=2+3
==>True
2013,2014
    2013=3*11*61
    2014=2*19*53
    11+61=19+53
==>True
8,15
    8=2^3
    15=3*5
    No possible sum
==>False
21,25
    21=3*7
    25=5^2
    No possible sum (can't do 3+7=5+5 because of exponent)
==>False
```
---
This is code golf. Standard rules apply. Shortest code in bytes wins.
  
[Answer]
# Julia, ~~95~~ 93 bytes
```
g(x)=reduce(vcat,map(p->map(sum,p),partitions([keys(factor(x))...])))
f(a,b)=g(a)∩g(b)!=[]
```
The primary function is `f` and it calls a helper function `g`.
Ungolfed:
```
function g(x::Integer)
    # Find the sum of each combination of prime factors of the input
    return reduce(vcat, map(p -> map(sum, p), partitions([keys(factor(x))...])))
end
function f(a::Integer, b::Integer)
    # Determine whether there's a nonzero intersection of the factor
    # sums of a and b
    return !isempty(g(a) ∩ g(b))
end
```
Saved 2 bytes thanks to Darth Alephalpha
[Answer]
## Pyth, 11 bytes
```
t@FmsMy{PdQ
```
Input in the form `30,7`.
```
t@FmsMy{PdQ     implicit: Q=input tuple
      y         powerset of
       {        unique elements of
        Pd      prime factorizations of d
    sM          Map sum over each element of the powerset
    sMy{Pd      lambda d: all sums of unique prime factors of d
   m      Q     Map over Q. Produces a two-element list.
 @F             Fold list intersection
t               Remove first element, which is a 0.
                If no other common sums, the remaining empty list is falsy.
              
              
              
              
```
[Answer]
# Pyth - ~~17~~ ~~12~~ 11 bytes
*Thanks to @FryAmTheEggman for fixing my answer and saving a byte.*
```
@FmsMty{PdQ
```
[Test Suite](http://pyth.herokuapp.com/?code=%40FmsMty%7BPdQ&test_suite=1&test_suite_input=5%2C+6%0A2014%2C+2013%0A8%2C+15%0A21%2C+25&debug=0).
[Answer]
## Haskell, ~~115~~ 106 bytes
```
import Data.Numbers.Primes
import Data.List
p=map sum.tail.subsequences.nub.primeFactors
a#b=p a/=p a\\p b
```
Usage example: `2013 # 2014` -> `True`.
`p` makes a list of all prime factors of it's argument, removes duplicates, makes a list of all subsequences, drops the first one (which is always the empty list) and finally sums the subsequences. `#` checks whether `p a` is not equal to the difference `p a \\ p b`. If not equal, they have at least one common element.
[Answer]
# Japt, 25 bytes
```
[UV]=N®k â à mx};Ud@J<VbX
```
Outputs `true` or `false`. [Try it online!](http://ethproductions.github.io/japt?v=master&code=W1VWXT1Ormsg4iDgIG14fTtVZEBKPFZiWA==&input=MjAxMyAyMDE0)
### Ungolfed and explanation
```
[UV]=N®   k â à mx};Ud@ J<VbX
[UV]=NmZ{Zk â à mx};UdX{J<VbX
          // Implicit: N = list of inputs
[UV]=N    // Set variables U and V to the first to items in N,
mZ{    }  // with each item Z mapped to:
Zk        //  Generate list of Z's factors.
â         //  Keep only the unique items.
à         //  Generate all combinations.
mx        //  Sum each combination.
UdX{      // Check if any item X in U fulfills this condition:
J<VbX     //  -1 is less than V.indexOf(X).
          // Implicit: output last expression
```
For an extra byte, you can split up the factorize-unique-combine-sum code between both inputs, with the added advantage of having a time complexity of `O(O(25-byte version)^2)`:
```
Uk â à mx d@J<Vk â à mx bX
```
[Answer]
## CJam, 23 bytes
```
q~{mf_&0a\{1$f++}/}/&0-
```
[Test it here.](http://cjam.aditsu.net/#code=q~%7Bmf_%260a%5C%7B1%24f%2B%2B%7D%2F%7D%2F%260-&input=%5B2013%202014%5D)
The truthy value will be all common sums concatenated, the falsy value is the empty string.
### Explanation
```
q~     e# Read and evaluate input.
{      e# For each of the two numbers...
  mf   e# Get the prime factors.
  _&   e# Remove duplicates.
  0a\  e# Put an array containing a 0 below to initialise the list of possible sums.
  {    e# For each prime factor...
    1$ e#   Make a copy of the available sums so far.
    f+ e#   Add the current factor to each of them.
    +  e#   Combine with the list of sums without that factor.
  }/
}/
&      e# Set intersection between the two lists of sums.
0-     e# Remove the 0 which is always in the intersection.
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), ~~10~~ 9 bytes
```
{ḋd⊇+ℕ₁}ᵛ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pf/ahtw6Ompkcdy5VKikpTlfRqQMy0xJziVKXa04vK/1c/3NGd8qirXftRy9RHTY21D7fO/v8/OtpUxyxWJ9rIwNBYB0iYANkWOoamICFDHSPT2FgA "Brachylog – Try It Online")
The predicate succeeds returning `[the sum, the sum]` if it exists, and fails if the sum does not exist.
```
{            Start of inline predicate.
 ḋ           The prime factors of the input,
  d          with duplicates removed.
   ⊇         Some subset of the unique prime factors
    +ℕ₁      has a sum greater than 0 which is output.
       }ᵛ    The predicate can have the same output for both elements of the input.
```
-1 byte thanks to Fatalize (the creator of Brachylog) reminding me that the *verify* meta-predicate exists.
[Answer]
# [MATL](https://esolangs.org/wiki/MATL), 23 bytes
```
2:"iYfutn2w^1-:B!Y*]!=z
```
Uses current release, [2.0.2](https://github.com/lmendo/MATL/releases/tag/2.0.2), which is earlier than this challenge.
The numbers are provided as two separate inputs. Output is `0` or `1`.
### Example
```
>> matl 2:"iYfutn2w^1-:B!Y*]!=z
> 2013
> 2014
1
```
### Explanation
```
2:           % vector of two numbers, to generate two iterations
"            % for loop
  i          % input number                                                 
  Yfu        % get prime factors without repetitions
  tn         % duplicate and get number of elements in array N 
  2w^1-:     % numbers from 1 to 2^N                                        
  B!Y*       % convert to binary, transpose and matrix multiply to produce all sums
]            % end                                                      
!=z          % true if any value is equal to any other
```
[Answer]
# Mathematica, 58 bytes
```
Tr/@Rest@Subsets[#&@@@FactorInteger@#]&/@IntersectingQ@##&
```
### Explanation:
This is an anonymous function.
First, `IntersectingQ` checks if two lists are intersecting. But the inputs are numbers instead of lists, so it remains unevaluated. For example, if the inputs are `2013` and `2014`, then `IntersectingQ@##&` returns `IntersectingQ[2013, 2014]`.
`Tr/@Rest@Subsets[#&@@@FactorInteger@#]&` is another anonymous function that takes an integer, gets a list of its prime factors without repetitions, takes the power set, removes the empty set, and then takes the sum of each set. So `Tr/@Rest@Subsets[#&@@@FactorInteger@#]&[2013]` returns `{3, 11, 61, 14, 64, 72, 75}`.
Then map `Tr/@Rest@Subsets[#&@@@FactorInteger@#]&` over the expression `IntersectingQ[2013, 2014]`. `Tr/@Rest@Subsets[#&@@@FactorInteger@#]&[2013]` and `Tr/@Rest@Subsets[#&@@@FactorInteger@#]&[2014]]` are lists, so we can get the collect result this time.
[Answer]
# [PARI/GP](http://pari.math.u-bordeaux.fr/), 98 bytes
Factor, grab primes (`[,1]`), loop over nonempty subsets, sum, and uniq, then intersect the result of this for the two numbers. The returned value is the number of intersections, which is truthy unless they are 0.
```
f(n,v=factor(n)[,1])=Set(vector(2^#v-1,i,vecsum(vecextract(v,i))))
g(m,n)=#setintersect(f(m),f(n))
```
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), ~~23~~ 17 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
-5 thanks to ngn
Anonymous tacit infix function.
```
1<≢⍤∩⍥(∊0+⍀.,∪⍤⍭)
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/qG@qp/@jtgkG/w0fdXTZPupteNS7tLpAW@/w9EddSwwftU1@1LvZSOtR56ICoKpHHase9a591Lu19n8aiNvbB9Hf1XxovfGjtolAXnCQM5AM8fAM/m@qkKZgxmVkYGgMZAApEy4LIMPQlMvIECRgCgA "APL (Dyalog Extended) – Try It Online")
`⍥{`…`}` apply the following anonymous function to both arguments:
 `⍭` prime factors
 `⍤` then
 `∪` the unique ones of those
 `0+⍀.,` addition table reduction of zero concatenated to each factor
 `∊` **ϵ**nlist (flatten)
`∩` the intersection
`⍤` then
`≢` the tally of those
`1<` is there more than one? (one because the sums of no factors)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~10~~ 8 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
f€æO`å¦à
```
-2 bytes thanks to *@Emigna*.
[Try it online](https://tio.run/##yy9OTMpM/f8/7VHTmsPL/BMOLz207PCC//@jjQwMjXWAhEksAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/tEdNaw4v8084vPTQssML/uv8j4421TGL1Yk2MjA01gESJkC2hY6hKUjIUMfINDYWAA).
**Explanation:**
```
f         # Get all distinct prime factors of both values in the (implicit) input-list
          #  i.e. [2013,2014] → [[3,11,61],[2,19,53]]
 €æ       # Get the powerset for each
          #  → [[[],[3],[11],[3,11],[61],[3,61],[11,61],[3,11,61]],
          #     [[],[2],[19],[2,19],[53],[2,53],[19,53],[2,19,53]]]
   O      # Sum each inner-most list
          #  → [[0,3,11,14,61,64,72,75],[0,2,19,21,53,55,72,74]]
    `     # Push both lists to the stack
     å    # Check for each value in the second list if it's present in the first list
          #  → [1,0,0,0,0,0,1,0]
      ¦   # Remove the first item (since the powerset included empty leading lists)
          #  → [0,0,0,0,0,1,0]
       à  # Check if any are truthy by taking the maximum (which is output implicitly)
          #  → 1
```
[Answer]
# Japt, 12 bytes
```
®k â à mx
rø
```
[Run it online](https://ethproductions.github.io/japt/?v=1.4.6&code=rmsg4iDgIG14CnL4&input=WwpbNSw2XSwKWzIwMTMsMjAxNF0sCls4LDE1XSwKWzIxLDI1XQpdCi1tUg==)
[Answer]
# [Python 3](https://docs.python.org/3/), 206 bytes
This is a lambda function (m), which takes in 2 numbers and returns a set containing any sums of prime factors that they have in common. In Python this is a truthy value when non-empty, and a falsey value when empty.
Edit: Turns out my original answer didn't work for prime inputs, as pointed out by @JoKing. This has been fixed (along with some other bugs) at the tragic cost of 40 bytes.
```
q=__import__('itertools').permutations
def p(n):
 i,s=2,set()
 while~-n:
  if n%i:i+=1
  else:n//=i;s|={i}
 return s
s=lambda f:{sum(i)for l in range(1,len(f)+1)for i in q(f,l)}
m=lambda a,b:s(p(a))&s(p(b))
```
Quick explanation using comments:
```
#Alias for permutations function
q=__import__('itertools').permutations
#Returns set of prime factors of n, including n, if prime
def p(n):
 i,s=2,set()
 while~-n:
  if n%i:i+=1
  else:n//=i;s|={i}
 return s
#Returns all possible sums of 2 or more elements in the given set
s=lambda f:{sum(i)for l in range(1,len(f)+1)for i in q(f,l)}
#Returns any shared possible sums of prime factors of a and b (the intersection of the sets)
m=lambda a,b:s(p(a))&s(p(b))
```
[Try it online!](https://tio.run/##TYvdagMhEIXvfQpvmswQ29RNU8IWn2VxiTYDOhp1KSVNX327KQRycw7f@cnf7ZR4N89nMwwUcyptGGBNzZWWUqhrfMmuxKnZRomrODovMzD2QpKqplPVNUAhv04U3O8zL7kkL/mJetoYvZAL1fW83Rr6qD/mQlchi2tTYVlFNcHG8Wil7y91ikDoU5FBEsti@dOBVsExeNzo/4ZuzRm8CngV8X62auwrZLCIq5uPiHMuxA0i7NU7orhT96p3apG3h@yg9P5xolW38PwH "Python 3 – Try It Online")
[Answer]
# APL(NARS), 50 char, 100 bytes
```
{⍬≢↑∩/+/¨¨{⍵∼⊂⍬}¨{0=⍴⍵:⊂⍬⋄s,(⊂1⌷⍵),¨s←∇1↓⍵}¨∪¨π¨⍵}
```
here π would find the array of factors on its argument;
```
{0=⍴⍵:⊂⍬⋄s,(⊂1⌷⍵),¨s←∇1↓⍵} 
```
would be the
function that find all subsets... i have to say that it seems {⍵operator itsArguments}¨ (for each left)
and ¨ (for each right) can imitate loop with fixed number of cycles and ¨¨ is ok in to see
subsets of one set... this way of see it seems reduce symbols in describe loops...; test
```
  h←{⍬≢↑∩/+/¨¨{⍵∼⊂⍬}¨{0=⍴⍵:⊂⍬⋄s,(⊂1⌷⍵),¨s←∇1↓⍵}¨∪¨π¨⍵}
  h 5 6
1
  h 2013 2014
1
  h 8 15
0
  h 21 25
0
```
One little analysis:
```
π¨⍵  for each arg apply factor 
∪¨ for each arg apply unique
{0=⍴⍵:⊂⍬⋄s,(⊂1⌷⍵),¨s←∇1↓⍵}¨ for each arg apply subsets
{⍵∼⊂⍬}¨ for each argument subtract Zilde enclosed (that would be the void set)
+/¨¨ for each arg (for each arg apply +/)
⍬≢↑∩/ apply intersection, get the first argument and see if it is Zilde (this it is right because enclosed Zilde it seems is the void set)
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-¡`](https://codegolf.meta.stackexchange.com/a/14339/), 14 bytes
```
®k â ã mx
rf Ê
```
Saved 3 bytes thanks to @Shaggy
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LaE&code=rmsg4iDjIG14CnJmIMo&input=WzIwMTMsMjAxNF0)
[Answer]
# [Gaia](https://github.com/splcurran/Gaia), ~~16~~ 11 bytes
```
ḍzΣ¦
↑@↑&ỵ!
```
[Try it online!](https://tio.run/##S0/MTPz//@GO3qpziw8t43rUNtEBiNUe7t6q@P@/kYGhCReQMAYA "Gaia – Try It Online")
The top function (first line) calculates the sums of the powerset of prime factors, and the second function finds if any of the elements of the intersection are nonzero.
]