Question: Who wrote the song "When I'm Sixty-Four?

full_context: Document 1: When I'm Sixty-Four: "When I'm Sixty-Four" is a song by the Beatles, written by Paul McCartney (credited to Lennon–McCartney) and released in 1967 on their album "Sgt. Pepper's Lonely Hearts Club Band".
Document 2: Linda McCartney's Sixties: Linda McCartney's Sixties: Portrait of an Era (published on 13 October 1992) is a book by Linda McCartney which presents a number of selected photographic portraits of rock legends. "Linda McCartney's Sixties: Portrait of an Era" continues to be the most famous work by McCartney. The text was written from interviews with Linda by Steve Turner who would go on to write 'A Hard Day's Write: The Stories Behind Every Beatles' Song' and 'The Gospel According to the Beatles.'
Document 3: Flaming Pie: Flaming Pie is the tenth solo studio album by Paul McCartney under his own name, first released in 1997. His first studio album in over four years, it was mostly recorded following McCartney's involvement in the highly successful "Beatles Anthology" project. The album was recorded in several locations over two years, 1995 and 1997, featuring two songs dating from 1992. The album featured several of McCartney's family members and friends, most notably McCartney's son, James McCartney. In "Flaming Pie"'s liner notes, McCartney said: ""[The Beatles Anthology]" reminded me of The Beatles' standards and the standards that we reached with the songs. So in a way it was a refresher course that set the framework for this album."
Document 4: Paul McCartney: Many Years from Now: Paul McCartney: Many Years from Now is a 1997 biography of Paul McCartney by Barry Miles. It is the "official" biography of McCartney and was written "based on hundreds of hours of exclusive interviews undertaken over a period of five years", according to the back cover of the 1998 paperback edition. The title is a phrase from McCartney's song "When I'm Sixty-Four", from the Beatles' 1967 album "Sgt. Pepper's Lonely Hearts Club Band". The book was first published in the United Kingdom in October 1997 by Secker & Warburg.
Document 5: Paul McCartney: Sir James Paul McCartney, {'1': ", '2': ", '3': ", '4': "} (born 18 June 1942) is an English singer-songwriter, multi-instrumentalist, and composer. He gained worldwide fame as the bass guitarist and singer for the rock band the Beatles, widely considered the most popular and influential group in the history of pop music. His songwriting partnership with John Lennon is the most celebrated of the post-war era. After the group disbanded in 1970, he pursued a solo career and formed the band Wings with his first wife, Linda, and Denny Laine.
Document 6: Return to Pepperland: Return to Pepperland is a cancelled Paul McCartney album recorded in 1984–1987. The album was built up of mostly home demos and was a reflection of work from McCartney's career as a member of the English rock band the Beatles. Although it was made around twenty years after the release of the Beatles' 1967 album "Sgt. Pepper's Lonely Hearts Club Band" (which inspired it), some tracks which made their way onto the bootleg were written whilst McCartney was in the Beatles, including the Lennon–McCartney-written "Love Me Do" and "P.S. I Love You". Other songs turned up on CD-single B-sides including the McCartney/Stewart song "Don't Break the Promise".
Document 7: Lennon–McCartney: Lennon–McCartney was the songwriting partnership between English musicians John Lennon (9 October 19408 December 1980) and Paul McCartney (born 18 June 1942) of the Beatles. It is one of the best known and most successful musical collaborations in history, with the Beatles selling over 600 million records, tapes and CDs as of 2004. Between 1962 and 1969, the partnership published approximately 180 jointly credited songs, of which the vast majority were recorded by the Beatles, forming the bulk of their catalogue.
Document 8: I'm the Greatest: "I'm the Greatest" is a song written by English musician John Lennon that was released as the opening track of the 1973 album "Ringo" by Ringo Starr. With Starr, Lennon and George Harrison appearing on the track, it marks the only time that three former Beatles recorded together between the band's break-up in 1970 and Lennon's death in 1980. Lennon wrote the song in December 1970 as a wry comment on his rise to fame, and later tailored the composition for Starr to sing. Named after one of Muhammad Ali's catchphrases, the song partly evokes the stage-show concept of the Beatles' 1967 album "Sgt. Pepper's Lonely Hearts Club Band".
Document 9: Life Begins at 40 (song): "Life Begins at 40" is a song by John Lennon. It was written in 1980, the year that both Lennon and Ringo Starr turned 40 years of age. Lennon recorded a demo of the song at his home, but it was not recorded at any of the sessions for his comeback album, "Double Fantasy." Instead, he intended to give the song to Starr to record on his own forthcoming album, "Can't Fight Lightning." The song's amiable country feel was well suited to Starr's singing style. After Lennon's murder in December 1980, those plans were shelved. However, Lennon's demo was eventually issued in 1998 on the "John Lennon Anthology" box set.
Document 10: When We Was Fab: "When We Was Fab" is a song by English musician George Harrison, which he released on his 1987 album "Cloud Nine". It was also issued as the second single from the album, in January 1988. The lyrics serve as a nostalgic reflection by Harrison on the days of Beatlemania during the 1960s, when the Beatles were first referred to as "the Fab Four". Harrison co-wrote the song with Jeff Lynne, who also co-produced the track. The recording references the psychedelic sound that the Beatles had helped popularise in 1967, through its use of sitar, cello, and backwards-relayed effects. Harrison's former Beatles bandmate Ringo Starr is among the other musicians on the track. The single was accompanied by an innovative music video, directed by the partnership of Kevin Godley and Lol Creme. One of Harrison's most popular songs, "When We Was Fab" has appeared on the compilations "Best of Dark Horse 1976–1989" (1989) and "" (2009).
Document 11: Lucy in the Sky with Diamonds: "Lucy in the Sky with Diamonds" is a song credited to Lennon–McCartney that appears on the Beatles' 1967 album "Sgt. Pepper's Lonely Hearts Club Band". It was started by John Lennon, then Paul McCartney contributed to it in a songwriting session. Lennon's son Julian inspired the song with a nursery school drawing he called "Lucy—in the sky with diamonds". Shortly after the song's release, speculation arose that the first letter of each of the title nouns intentionally spelled "LSD". Lennon consistently denied this, insisting the song's fantastical imagery was inspired by Lewis Carroll's "Alice in Wonderland" books, a claim repeatedly confirmed by Paul McCartney.
Document 12: Sgt. Pepper's Lonely Hearts Club Band: Sgt. Pepper's Lonely Hearts Club Band is the eighth studio album by English rock band the Beatles. Released on 26 May 1967 in the United Kingdom and 2 June 1967 in the United States, it was an immediate commercial and critical success, spending 27 weeks at the top of the UK albums chart and 15 weeks at number one in the US. On release, the album was lauded by the vast majority of critics for its innovations in music production, songwriting and graphic design, for bridging a cultural divide between popular music and legitimate art, and for providing a musical representation of its generation and the contemporary counterculture. It won four Grammy Awards in 1968, including Album of the Year, the first rock LP to receive this honour.
Document 13: McCartney (album): McCartney is the debut studio album by English musician Paul McCartney. It was issued on Apple Records in April 1970 after McCartney had resisted attempts by his fellow Beatles to have the release delayed to allow for Apple's previously scheduled titles, notably the band's "Let It Be" album. McCartney recorded this solo album during a period of depression and confusion, following John Lennon's private announcement on September 20, 1969 that he was leaving the Beatles, and the conflict over its release further estranged McCartney from his bandmates. A press release in the form of a self-interview, supplied with UK promotional copies of "McCartney", led to the announcement of the group's break-up on 10 April 1970.
Document 14: Sgt. Pepper's Lonely Hearts Club Band (song): "Sgt. Pepper's Lonely Hearts Club Band" is a song written by Paul McCartney (credited to Lennon–McCartney), and first recorded and released in 1967, on the album of the same name by the Beatles. The song appears twice on the album: as the opening track (segueing into "With a Little Help from My Friends"), and as "Sgt. Pepper's Lonely Hearts Club Band (Reprise)", the penultimate track (segueing into "A Day in the Life"). As the title song, the lyrics introduce the fictional band that performs on the album.
Document 15: Early 1970: "Early 1970" is a song by English musician Ringo Starr, released in April 1971 as the B-side to his hit single "It Don't Come Easy". It was inspired by the break-up of the Beatles and documents Starr's relationship with his former bandmates, John Lennon, Paul McCartney and George Harrison. The lyrics to the verses comment in turn on each of the ex-Beatles' personal lives and the likelihood of each of them making music with Starr again; in the final verse, Starr acknowledges his musical limitations before expressing the hope that all the former Beatles will play together in the future. Commentators have variously described "Early 1970" as "a rough draft of a peace treaty" and "a disarming open letter" from Starr to Lennon, McCartney and Harrison.
ground_truth: Paul McCartney