To put it unkindly, The Solitude of Prime Numbers is like a feature version of The Undatables. It's based around a boy and a girl who are drawn together through their common status of socially awkward outsiders, but who are so messed up that their encounters are painful and the chances of them actually ever getting together seem very slim.
Mattea is super-intelligent but moody, withdrawn and uncommunicative with his parents and friends. As a young boy he was close to his mentally disabled sister Michela and looked after her, calming her during her 'episodes' As a young man, Michela is no longer there, and there is clearly an experience in their childhood to be revealed that that has marked Mattea and left their mark on him in the form of self-harming.
Alice also has visible scars. She walks with a limp and is bullied by the other girls, who call her a gimp. One of the girls, Viola, becomes her friend however and encourages her to pursue her attraction to the sullen Mattea by inviting him to a party. Her family life however has also been troubled, with a pushy father and an unstable mother. Neither Mattea nor Alice fit in with the world around them and suffer at the hands and from the taunts of others, but it's nothing to the suffering and the pain that they inflict upon themselves over incidents in their childhood.
In terms of storyline it's as straightforward as that, but the structure of the film split into different time zones for both Mattea and Alice does complicate matters. Or not so much complicate as attempt to create a non-linear impression of a fractured mindset. It's a fractured past however that nonetheless shares echoes and correspondences between them, between past and present, between two people each trapped in their own worlds and in their pasts.
There are moments when you feel that some kind of escape or redemption might be within their grasp, where they might make a connection that could help them to face up to the past and escape from what the might become, but the traps of the mind keep preventing them from getting past the past. There are moments of melodrama and intensity, but good performances from Alba Rohrwacher and Luca Marinelli give a human face to the weight of torment that some people have to endure all their lives.