At a total time of 8:22, the longest Beatles track ever officially released is “Revolution 9” from the album The Beatles (better known as The White Album). The recording is not so much of a song, but more of an avant garde sound collage.
Though credited to Lennon/McCartney (as was the songwriting partnership tradition), Paul McCartney had the least to do with the track compared to the other Beatles. It was primarily the work of John Lennon, with some contributions from Yoko Ono, George Harrison, and Ringo Starr.