Hi MisterSynergy, was having a look at Wikidata:WikiProject sum of all paintings/Duplicate paintings. Only the "Paintings with same image" currently works, but is full of suggestions like Sunflowers (Q157541) & Sunflowers (Q21948567) that shouldn't be in the list. Looking at the source, can you change the query to only instance of painting and not all subclasses? I needed to add a limit to prevent it from timing out.
https://w.wiki/A$wi for the inventory number query completes just in time and I had to remove the sort from https://w.wiki/A$wo to complete the catelog query. Maybe you can update the code based on that?