Microsoft founder Bill Gates, who attended Harvard, returns to campus this weekend for a question-and-answer session as part of the launch of The Harvard Campaign. Below, author Walter Isaacson, who is writing a book about the great inventors of the digital age, recalls Gates’ formative years at Harvard.It may have been the most momentous purchase of a magazine in the history of the Out of Town News stand in Harvard Square. Paul Allen, a college dropout from Seattle, wandered into the cluttered kiosk one snowy day in December 1974 and saw that the new issue of Popular Electronics featured a home computer for hobbyists, called the Altair, that was just coming on the market. He was both exhilarated and dismayed. Although thrilled that the era of the “personal” computer seemed to have arrived, he was afraid that he was going to miss the party. Slapping down 75 cents, he grabbed the issue and trotted through the slush to the Currier House room of Bill Gates, a Harvard sophomore and fellow computer fanatic from Lakeside High School in Seattle, who had convinced Allen to drop out of college and move to Cambridge. “Hey, this thing is happening without us,” Allen declared. Gates began to rock back and forth, as he often did during moments of intensity. When he finished the article, he realized that Allen was right. For the next eight weeks, the two of them embarked on a frenzy of code writing that would change the nature of the computer business.What Gates and Allen set out to do, during the Christmas break of 1974 and the subsequent January reading period when Gates was supposed to be studying for exams, was to create the software for personal computers. “When Paul showed me that magazine, there was no such thing as a software industry,” Gates recalled. “We had the insight that you could create one. And we did.” Years later, reflecting on his innovations, he said, “That was the most important idea that I ever had.”In high school, Gates had formed the Lakeside Programming Group, which made money writing computer code for companies in the Pacific Northwest. As a senior, he applied only to three colleges — Harvard, Yale, and Princeton — and he took different approaches to each. “I was born to apply for college,” he said, fully aware of his ability to ace meritocratic processes. For Yale he cast himself as an aspiring political type and emphasized the month he had spent in Washington as a congressional page. For Princeton, he focused only on his desire to be a computer engineer. And for Harvard, he said his passion was math. He had also considered MIT, but at the last moment blew off the interview to play pinball. He was accepted to all three, and chose Harvard. “There are going to be some guys at Harvard who are smarter than you,” Allen warned him. Gates replied, “ ‘No way! No way!’ ”When he was asked to describe the types of roommates he preferred, Gates asked for an African American and an international student. He was assigned to Wigglesworth Hall with Sam Znaimer, a science geek from a family of poor Jewish refugees in Montreal, and Jim Jenkins, a black student from Chattanooga, Tenn. Znaimer, who had never known a privileged WASP before, found Gates friendly but weirdly fascinating. He marveled as Gates spent several nights filling out various federal and state tax forms for the revenues of his high school programming firm, and was astounded by the intensity of his study schedule. “His habit was to do 36 hours or more at a stretch, collapse for 10 hours, then go out, get a pizza, and go back at it,” he recalled. “And if that meant he was starting again at 3 in the morning, so be it.” When working hard, Gates would rock back and forth. Then he would grab Znaimer for a frenzy of playing Pong, the Atari video game, in the dorm lounge, or Spacewar!, a legendary game invented at MIT, on one of the mainframes in Harvard’s computer lab.After their freshman year, Bill Gates and Andy Braiterman, who was better at math than Gates, decided to room together. They were assigned to Currier House, which Gates loved. Jon Chase/Harvard Staff PhotographerThe lab was named after Harvard’s computer science pioneer Howard Aiken, who had invented an electromechanical computer known as the Mark I, which now sits in the lobby of the Science Center. The Aiken Lab housed one of Gates’s favorite machines: a PDP-10 from Digital Equipment Co. It had been destined for use in Vietnam but was reassigned to Harvard to assist military-funded research there. To avoid sparking an antiwar protest, it was smuggled into the lab early one Sunday morning in 1969. There were also a slew of PDP-1 computers on which to play Spacewar! For his freshman computer project, Gates linked the PDP-10 and a PDP-1 to create a video baseball game. “The logic was on the PDP-10, but I sent it down to the PDP-1 because I used the same display as Spacewar!, a line-drawing display which you don’t see anymore,” said Gates.Allen’s warning to Gates that he would not always be the smartest kid in class turned out to be true. There was a freshman who lived upstairs from him in Wigglesworth who was better at math, Andy Braiterman from Baltimore. They would wrestle with Math 55 problem sets all night in Braiterman’s room, eating pizza. “Bill was intense,” Braiterman remembered, both about math and poker. He was also “a good arguer.” Gates was particularly forceful in asserting that soon everyone would have a home computer that could be used for calling up books and other information. He and Braiterman decided to room together, and they were assigned to Currier House, which Gates loved.Gates decided to major in applied math rather than pure math. “I met several people in the math department who were quite a bit better than I was in math,” he said. “It changed my mind about going into math.” He was able to make a small mark on the field of applied math. In a class taught by computer scientist Harry Lewis, he was introduced to a classic problem:The chef in our place is sloppy, and when he prepares a stack of pancakes they come out all different sizes. Therefore, when I deliver them to a customer, on the way to the table I rearrange them (so that the smallest winds up on top, and so on, down to the largest at the bottom) by grabbing several from the top and flipping them over, repeating this (varying the number I flip) as many times as necessary. If there are n pancakes, what is the maximum number of flips (as a function f(n) of n) that I will ever have to use to rearrange them?The answer required coming up with a good algorithm, just as any computer program did. “I posed it in class, and then I went on,” Lewis recalled. “And a day or two later, this smart sophomore comes into my office and explains that he’s got a five-thirds N algorithm.” In other words, Gates had figured out a way to do it with five-thirds flips per the number of pancakes in the stack. “It involved a complicated case analysis of what exactly the configuration of the top few pancakes might look like,” Lewis recalled. “It was quite clever.” A teaching assistant in the class, Christos Papadimitriou, later published the solution in a scholarly paper co-authored with Gates.Gates developed a rebellious academic pattern: He would not go to the lectures for any course in which he was enrolled, but he would audit classes that he was not taking. He followed this rule carefully. “By my sophomore year, I was auditing classes that met at the same time as my actual classes just to make sure I’d never make a mistake,” he recalled. “So I was this complete rejectionist.”He also took up poker with a vengeance. The games would last all night in one of the common rooms of Currier House, which became known as the Poker Room. His game of choice was Seven Card Stud, high low. A thousand dollars or more could be won or lost per night. Gates was better at assessing the cards than in reading the thoughts of his fellow players. “Bill had a monomaniacal quality,” Braiterman said. “He would focus on something and really stick with it.” At one point he gave Paul Allen his checkbook to try to stop himself from squandering more money, but he soon demanded it back. “He was getting some costly lessons in bluffing,” said Allen. “He’d win $300 one night and lose $600 the next. As Bill dropped thousands that fall, he kept telling me, ‘I’m getting better.’ ”In a graduate-level Economics 2010 class taught by Michael Spence, Gates met a student who lived down the hall from him at Currier House. Steve Ballmer was very different from Gates on the surface. He was big, boisterous, and gregarious, the type of campus enthusiast who seemed to join or lead every organization. He was in the Hasty Pudding Club, the manager of the football team, the publisher of the Advocate, and the advertising manager of the Crimson. What bound the two was their shared super-intensity. They would talk and argue and study together at high volume, each of them rocking back and forth. Then they would go see movies together. “We went and saw ‘Singin’ in the Rain’ and ‘A Clockwork Orange,’ which are only connected by the use of a common song,” said Gates. “And then we got to be super-good friends.”Such was Gates’s life at Harvard when it was suddenly changed, halfway through his sophomore year, by Allen’s arrival at his Currier House room with his newly purchased copy of Popular Electronics featuring the Altair on the cover. Allen’s rallying cry — “Hey, this thing is happening without us” — jolted Gates into action.Gates and Allen set out to write some software that would make it possible for hobbyists to create their own programs on the Altair. Specifically, they decided to write an interpreter for the programming language known as BASIC that would run on the Altair’s Intel 8080 microprocessor. It would become the first commercial native high-level programming language for a microprocessor. In other words, it would launch the personal computer software industry.They wrote a letter to MITS, the fledgling Albuquerque company that made the Altair, claiming that they had created a BASIC language interpreter that could run on the 8080. “We are interested in selling copies of this software to hobbyists through you.” In reality, they did not yet have any software. But they knew they could scramble and write it if MITS expressed interest.When they did not hear back, they decided to call. Gates suggested that Allen place the call, because he was older. “No, you should do it; you’re better at this kind of thing,” Allen argued. They came up with a compromise: Gates would call, disguising his squeaky voice, but he would use the name Paul Allen, because they knew it would be Allen who would fly out to Albuquerque if they got lucky. “I had my beard going and at least looked like an adult, while Bill still could pass for a high school sophomore,” recalled Allen.When the founder of MITS, Ed Roberts, answered the phone, Gates put on a deep voice and said, “This is Paul Allen in Boston. We’ve got a BASIC for the Altair that’s just about finished, and we’d like to come out and show it to you.” Roberts replied that he had gotten many such calls. The first person to walk through his door in Albuquerque with a working BASIC would get the contract. Gates turned to Allen and exulted, “God, we gotta get going on this!’”Because they did not have an Altair to work on, Allen had to emulate one on the PDP-10 mainframe at the Aiken Lab. So they bought a manual for the 8080 microprocessor and within weeks Allen had the simulator and other development tools ready.Meanwhile, Gates was furiously writing the BASIC interpreter code on yellow legal pads. “I can still see him alternately pacing and rocking for long periods before jotting on a yellow legal pad, his fingers stained from a rainbow of felt-tip pens,” Allen recalled. “Once my simulator was in place and he was able to use the PDP-10, Bill moved to a terminal and peered at his legal pad as he rocked. Then he’d type a flurry of code with those strange hand positions of his, and repeat. He could go like that for hours at a stretch.”One night they were having dinner at Currier House, sitting at the table with the other math geeks, and they began complaining about facing the tedious task of writing the floating-point math routines, which would give the program the ability to deal with both very small and very large numbers in scientific notation. A curly-haired kid from Milwaukee named Monte Davidoff piped up, “I’ve written those types of routines.” It was the benefit of being at Harvard. Gates and Allen began peppering him with questions about his capacity to handle floating-point code. Satisfied they knew what he was talking about, they brought him to Gates’s room and negotiated a fee of $400 for his work. He became the third member of the team, and would eventually earn a lot more.Gates ignored the exam cramming he was supposed to be doing and even stopped playing poker. For eight weeks, he, Allen, and Davidoff holed up day and night at the Aiken lab making history. Occasionally they would break for dinner at Harvard House of Pizza or at Aku Aku, an ersatz Polynesian restaurant. In the wee hours of the morning, Gates would sometimes fall asleep at the terminal. “He’d be in the middle of a line of code when he’d gradually tilt forward until his nose touched the keyboard,” Allen said. “After dozing an hour or two, he’d open his eyes, squint at the screen, blink twice, and resume precisely where he’d left off — a prodigious feat of concentration.”They would scribble away at their notepads, competing to see who could execute a subroutine in the fewest lines. “I can do it in nine,” one would shout. Another would shoot back, “Well, I can do it in five!” As Allen noted, “We knew that each byte saved would leave that much more room for users to add to their applications.” The goal was to get the program into less than the 4K of memory that an enhanced Altair would have, so there would be a little room left over for the consumer to use. (A 16GB smartphone has four million times that memory.) At night they would fan out the printouts onto the floor and search for ways to make it more elegant and compact. By late February 1975, after eight weeks of intense coding, they got it down, brilliantly, into 3.2K. “It wasn’t a question of whether I could write the program, but rather a question of whether I could squeeze it into under 4K and make it super fast,” said Gates. “It was the coolest program I ever wrote.” Gates checked it for errors one last time, then commanded the Aiken lab’s PDP-10 to spew out a punch-tape of it so Allen could take it down to Albuquerque.When Allen arrived at MITS, he toggled the switches on the Altair and then waited 10 minutes for the tape reader to load in the code. Ed Roberts and his colleagues exchanged amused glances, already suspecting that the show would be a fiasco. But then the Teletype clacked to life. “MEMORY SIZE?” it asked. “Hey, it typed something!” shouted one of the MITS team. Allen was happily flabbergasted. He typed in the answer: 7168. The Altair responded: “OK.” Allen typed in: “PRINT 2+2”. It was the simplest of all questions, but it would test not only Gates’s coding but also Davidoff’s floating-point math routines. The Altair responded: “4.”Up until then, Roberts had been watching quietly. He had taken his failing company further into debt on the wild surmise that he could create a computer that a home hobbyist could use and afford. Now he was watching as history was made. For the first time, a software program had run on a commercially viable home computer. “Oh my God,” he shouted. “It printed ‘4’!”Rogers invited Allen into his office and agreed to license the BASIC interpreter for inclusion on all Altair machines. “I couldn’t stop grinning,” Allen recalled. As soon as he got back to his hotel, Allen called Gates at Harvard. They were officially in business. When Allen arrived back in Cambridge, bringing with him a working Altair to install in Gates’s Currier House room, they went out to celebrate. Gates had his usual, a Shirley Temple: ginger ale with maraschino cherry juice.A month later, Roberts offered Allen a fulltime job at MITS as director of software. Gates decided to stay at Harvard, at least for the time being. There he endured what has become a rite of passage, amusing only in retrospect, for many of Harvard’s most successful students: being hauled before the dreaded and then-secretive Administrative Board for a disciplinary process, known as being “Ad Boarded.” Gates’s case arose when auditors from the Defense Department decided to check the use of the PDP-10 that it was funding in Harvard’s Aiken lab. They discovered that one sophomore — W.H. Gates — was using most of the time. After much fretting, Gates prepared a paper defending himself and describing how he had created a version of BASIC using the PDP-10 as a simulator. He ended up being exonerated for his use of the machine, but he was “admonished” for allowing a non-student, Allen, to log on with his password. He accepted that minor reprimand and agreed to put his early version of the BASIC interpreter (but not the refined one he and Allen were by then working on) into the public domain.By that time, Gates was focusing more on his software partnership with Allen than his coursework at Harvard. He finished his sophomore year that spring of 1975, but then flew down to Albuquerque for the summer and decided to stay there rather than returning for the first semester of his junior year that fall. He went back to Harvard for two more semesters, in the spring and fall of 1976, but then left Harvard for good, two semesters shy of graduating. In June 2007, when he returned to Harvard to get an honorary degree, he began his speech by directing a comment to his father in the audience. “I’ve been waiting more than 30 years to say this: Dad, I always told you I’d come back and get my degree.”Walter Isaacson has written biographies of Steve Jobs, Albert Einstein, and Benjamin Franklin. He is a Harvard Overseer.