Darkness had fallen over Longs Peak in Colorado’s Rocky Mountain National Park, and Andrew Hamilton was struggling to find his way. He wasn’t entirely alone. A handful of people trailed close behind him, and fans in places like London, Atlanta and Kansas City were following the progress of the 40-year-old stay-at-home dad and preternatural hiker online as his tracking beacon mapped his location in real time. Hamilton was on pace to break the speed record for climbing all 58 of Colorado’s “fourteeners” — mountains at least 14,000 feet above sea level — but first he needed to find the keyhole. Named for its shape, the giant rock notch serves as a waypoint on the standard route up Longs Peak, and it’s usually hard to miss. He’d had better conditions on this peak the first time he’d set the record, back in 1999. But on this night, the only light was from his headlamp, and this final peak he needed for the record was shrouded in fog. Hamilton had gone nine days without more than a couple of hours of sleep at a time. And now the wind was blasting, and the rain was turning to snow.

The five hikers following him could offer moral support, but to secure the record, Hamilton had to do the route-finding himself. After some bumbling around, he finally located the keyhole, and from there, he was looking for bull’s-eyes — route markers painted on the rocks along the final mile and a half to the summit. Each time he found one, the crew behind him cheered. Meanwhile, his Internet fans discussed the blow-by-blow of his attempt on the 14ers.com forum. As Hamilton navigated the exposed section leading to the summit — a place where people regularly fall and die, even in good weather — the markers became obscured by snow. He was down to wits alone.

With the help of crampons and an ice ax, Hamilton finally reached the summit. Longs Peak had put up a fierce battle, but he’d made it. Descending would be hazardous too, but at least he’d have his tracks to follow. Hamilton reached the finish of his Longs Peak climb at 2:21 a.m. on July 9 — nine days, 21 hours, 51 minutes and 264.5 miles after he’d embarked on the 58-peak adventure. His time set a new record, slicing nearly 24 hours off the previous one. Never mind that it was the middle of the night — a crowd of more than 40 people was waiting to congratulate him.

One of the people there to greet Hamilton was Teddy Keizer, who’d held the record for 15 years. It was his 44th birthday, and he’d flown in from Oregon. “It felt fantastic to be there,” he told me later. “You don’t get to see history in the making very often, and there couldn’t be a more deserving person to hold the record.”

Such sportsmanship is a hallmark of the pursuit. The Colorado fourteeners record has no organizing body or official regulations. “It’s a gentleman’s sport,” said ultra-marathoner Buzz Burrell, who helped popularize the notion of FKTs or “fastest known times” on mountain trails. “It’s unofficial,” he said. “It’s always been for personal achievement and the respect of your peers.” The event isn’t just for gentlemen, however. Danelle Ballengee, an accomplished runner and adventure racer, set the women’s record in 2000 and had been on track to break the men’s record until a lightning storm turned her around on Mount Lindsey. (She drove away from the mountain intending to drop out, but after a six-hour nap decided she couldn’t quit.)

Cleve McCarty pioneered the speed record by climbing all of Colorado’s fourteeners (then recognized as 52) in 52 days in 1960. It wasn’t until runners started going after the record in the 1990s that the event became more like a race — the Mighty Mountain Megamarathon — than a recreational goal.

Trying to set the fourteener record is more than just a test of human endurance; it’s also a data optimization problem. Colorado’s 58 fourteeners are scattered over approximately a third of the state. The clock begins with the first climb and stops with the last, so it’s not enough to hike fast. If you want the record, you need to find the most efficient route and minimize the time wasted getting from one climb to the next.

Keizer, known as “Cave Dog” on the trail, understood this better than anyone. Before making his successful record attempt in 2000, the then-29-year-old spent four and a half years researching the problem, scouting routes and planning every detail. This was before GPS driving instructions were ubiquitous, and he drove all over Colorado to construct a 30-page book of directions — “every tenth of a mile, every turn” — for his crew. Before Keizer, most record-seekers tried to mix and match easy peaks with more difficult ones, which meant lots of extra travel time. “That’s crazy,” Keizer said. “I wanted to find the most efficient route.”

Keizer also changed the approach to recovery. Hamilton told me that previous record-holders Rick Trujillo and Ricky Denesik, renowned Colorado mountain runners, blasted up and down the peaks as fast as they could but then would grab a meal at a Mexican food joint and go sleep six or eight hours. “Teddy took away all the sleep and took two days off the record,” Hamilton said.

Keizer’s optimized routing and decision to sleep while in transit allowed him to shave more than 25 hours off the time that Hamilton spent in transition from one climb to the next during his 1999 record. Even though Keizer’s hiking pace was significantly slower than Denesik’s in his 1997 record, his transition time was almost 100 hours faster.

Keizer’s many years of preparation had left few details to tweak, but Hamilton found some places for improvement. Keizer’s order of operations forced him to travel from Pikes Peak, just outside of Colorado Springs, to Longs Peak, northwest of Denver, during rush hour, and he lost valuable time stuck in traffic. Hamilton reworked the route so that those two peaks weren’t back-to-back, and he also linked some peaks in the Elk range into a single outing. Hiking those peaks in a single push took him 24 hours, Hamilton said: “But it was an entire day I took off of Teddy.”

For future challengers, Keizer wrote down the informal rules already in place and added a few of his own. The most long-standing one is the 3,000-foot rule, also called the Colorado rule, which requires record-seekers to ascend at least 3,000 feet in absolute elevation from a start of a climb to the first summit and descend at least 3,000 feet before leaving the series of peaks.

One thing that Keizer’s rules don’t explicitly address is the Culebra question. Culebra Peak is privately owned, part of an 80,000-acre ranch in southern Colorado, and right now, the only way to climb it is to pay $150 and show up on a pre-arranged weekend day and time. That obviously throws a wrench into the planning of a record attempt, and one of Hamilton’s crew members arranged for him to have less restricted access. A few commenters on the fourteener forums questioned the fairness of this. While hesitating to call it unfair, Peter Bakwin, the owner of the Fastest Known Time website, told me: “I don’t real like that he did it, because it’s not available to everyone.” Hamilton stands by his decision, which Keizer supports. Of course Hamilton should set up access, Keizer told me: “Part of the logistics is getting that special permission.”

Yet logistics are only part of the equation. Fitness and mountaineering skills are also necessary, but nothing’s more crucial than winning the mental game. “You’re out there in the dark, you’re tired, you want to quit,” Hamilton said. Muscle fatigue and sore joints were only the beginning. He also fought the “sleep demons” — the sometimes overwhelming urge to fall asleep. He coped by downing 5-Hour Energy shots and listening to a repeating playlist of Taylor Swift, Meghan Trainor and other “pump” songs he’d preloaded on his iPhone.

Hamilton’s low point came on day four. He had six peaks on the agenda, and after ticking off the first one, Culebra, and summiting and traversing the Crestones, he headed toward Kit Carson Peak. But first, he had to get around Obstruction Peak. “It’s sort of just in the way,” Hamilton said. It was raining, he was surrounded by fog, and an irritated tendon in his ankle was killing him. With no trail along this route, he was blazing his own way, and lightning was moving in. “I started thinking it would be better to get struck than to have to drop out,” he recalled.

Lightning is no idle threat. Several days after Hamilton set his record, a honeymooner was struck and killed on Mount Yale. The element of risk involved in seeking the fourteener record makes it more than a gauge of fitness and logistics; it’s also a test of decision-making under pressure. “This is a mountaineering adventure, not a running adventure,” Keizer said, which is why he proposed that the record-setter must always do the route-finding. “You’re down to the elements, and you have to be able to survive by your own wits.” The mental game is far more difficult than the physical one, he said. “When it’s 2 a.m., on a technical rock face and the hail starts hitting you, and you’re strapped on some rock, trying not to fall off the peak, you have to posses the serenity that allows you to withstand the elements,” Keizer said.

When Keizer set his record, he climbed 50 of the peaks solo. But when Hamilton made his attempt last month, he had people watching at every turn. The advent of the Internet and satellite tracking devices has turned things like fourteener record attempts into spectator sports. Hamilton’s satellite tracker uploaded his whereabouts on a topo map in real time. As he went, many of his online supporters showed up in person to follow him and cheer. “There were times when it felt like that scene from ‘Forrest Gump’ where he’s running across the country and a pack of people are just following behind him,” Hamilton said.

Hamilton was pleased to break the fourteener record by what he called a “satisfying” margin. “It’s going to be under attack, and I’m OK with that,” he said. “It’s going to be fun to see.” Given how badly it was handicapped by weather, Ballengee’s women’s record seems even more ripe for the picking, and although she doesn’t intend to try again, she told me that she’d love to see someone go after it. “I think there’s a chance that a woman could go and break the men’s record,” she said, pointing out that until Scott Jurek broke it by a narrow margin on July 12, Jennifer Pharr Davis held the speed record on the Appalachian Trail. Who’s next is anybody’s guess, but what’s almost certain is that the next challenger will have a posse of fans watching it all unfold in real time from the comfort of somewhere else.

CORRECTION (Aug. 5, 8:34 p.m.): An earlier version of this post listed the wrong source for the chart that shows the time record-seekers spent hiking vs. transitioning between peaks. It comes from Andrew Hamilton, not Charles Komanoff.