Given an array of positive or negative integers 
 I= [i1,..,in]
you have to produce a sorted array P of the form 
[ [p, sum of all ij of I for which p is a prime factor (p positive) of ij] ...]
P will be sorted by increasing order of the prime numbers.
The final result has to be given as a string in Java, C#, C, C++ and as an array of arrays in other languages.
Example:
```python
I = [12, 15] # result = [[2, 12], [3, 27], [5, 15]]
```
[2, 3, 5] is the list of all prime factors of the elements of I, hence the result.
**Notes:**
- It can happen that a sum is 0 if some numbers are negative!
Example: I = [15, 30, -45]
5 divides 15, 30 and (-45) so 5 appears in the result, the sum of the numbers for which 5 is a factor is 0 so we have [5, 0] in the result amongst others. 
- In Fortran - as in any other language - the returned string is not permitted to contain any redundant trailing whitespace: you can use dynamically allocated character strings.
def sum_for_list(lst):
    def buscar_primxs(x):
        res=[]
        x=abs(x)
        for i in range(2,int(x/2)+1):
            if (x//i)*i==x:
                    if i==2 or i==3:
                        res.append(i)
                    else:
                        c=0
                        for j in range(2,i):
                             if (i//j)*j==i:
                                    c=c+1
                        if c==0:
                            res.append(i)
        if res==[]:
            return([x])
        return(res)
        
    R={}
    for x in lst:
        for elements in buscar_primxs(x):
            if elements in R:
                R[elements]+=x
            else:
                R[elements]=x
    rta=[]
    
    M=[x for x in R]

    M=sorted(M)

    for keys in M:
        rta.append([keys,R[keys]])
    return(rta)
def sum_for_list(lst):
    def buscar_primxs(x):
        res=[]
        x=abs(x)
        for i in range(2,int(x/2)+1):
            if (x//i)*i==x:
                    if i==2 or i==3:
                        res.append(i)
                    else:
                        c=0
                        for j in range(2,i):
                             if (i//j)*j==i:
                                    c=c+1
                        if c==0:
                            res.append(i)
        if res==[]:
            return([x])
        return(res)
        
    R={}
    for x in lst:
        for elements in buscar_primxs(x):
            if elements in R:
                R[elements]+=x
            else:
                R[elements]=x
    rta=[]
    
    M=[x for x in R]

    M=sorted(M)

    for keys in M:
        rta.append([keys,R[keys]])
    return(rta)