“He’d stand up and say: ‘Wait a minute! The trombone is two notes off,’ ” Fran Peek said.

Mr. Peek had an uncanny facility with the calendar.

“When an interviewer offered that he had been born on March 31, 1956, Peek noted, in less than a second, that it was a Saturday on Easter weekend,” Dr. Treffert and Dr. Daniel D. Christensen wrote about Mr. Peek in Scientific American in 2006.

They added: “He knows all the area codes and ZIP codes in the U.S., together with the television stations serving those locales. He learns the maps in the front of phone books and can provide MapQuest-like travel directions within any major U.S. city or between any pair of them. He can identify hundreds of classical compositions, tell when and where each was composed and first performed, give the name of the composer and many biographical details, and even discuss the formal and tonal components of the music. Most intriguing of all, he appears to be developing a new skill in middle life. Whereas before he could merely talk about music, for the past two years he has been learning to play it.”

Mr. Peek, who was dismissed as mentally retarded as a child and later misdiagnosed as autistic, led a sheltered life, with few people outside his family aware of his remarkable gifts. Then, in 1984, he met Mr. Morrow at a meeting of the Association of Retarded Citizens in Arlington, Tex. Mr. Peek’s father was chairman of the group’s communications committee, and Mr. Morrow had helped create two television movies about a retarded man named Bill (played by Mickey Rooney).

After Mr. Peek displayed his memory skills in a conversation with him, Mr. Morrow set about concocting a story around someone like Kim Peek. “I was absolutely flabbergasted that such a human being existed,” Mr. Morrow said in a 2006 documentary about Mr. Peek.

In “Rain Man,” the autistic character, Raymond Babbitt, has been institutionalized since he was very young but is reunited with a cynical younger brother, Charlie (played by Tom Cruise), who had forgotten about his brother’s existence. (The title comes from Raymond’s recollection of the infant Charlie’s name for him.) The two men take a cross-country trip, and fraternal reconciliation ensues.

The movie, a critical and box office success, was not based on Mr. Peek’s life, but in preparing for the role, Mr. Hoffman visited with Mr. Peek and incorporated many of his characteristics  a shambling gait, peculiar hand movements and occasional blunt utterances  into the character of Raymond.