On a recent morning, at precisely 11:00, Therese Stählin was waiting in silence outside the entrance to the baroque town of Solothurn, clock-watching. “At 12:00, we need to be at our 11-hour clock,” she said, all aflutter upon my arrival. Eleven was the most auspicious time to meet in the city, she’d emailed a few days prior, but it was equally important for us not to be late for midday. We had to hurry.

Crossing a footbridge over the Aare River, she cut left on Klosterplatz, pressing on past a grand 18th-Century warehouse – rushing, rushing – to a place that would reveal much about the history and extraordinary obsession of this little-known town in the shadow of Switzerland’s Jura Mountains. For hidden in plain sight, on the west wall of an investment bank, is a wall-mounted clock. And it is a key to a curiosity unknown even to most Swiss.

The clock, with its 11-hour dial and number 12 missing, is a confusing anomaly to any unsuspecting passer-by. But make no mistake; it is no accident. When its 11 cogs turn to chime its 11 bells – courtesy of a harlequin dutifully striking a hammer at the random times of 11:00, 12:00, 17:00 and 18:00 – the metalwork sculpture performs the Solothurner Lied, the city’s unofficial anthem. The clock doesn’t just tell the time, albeit in a puzzling way. It helps reveal the town’s fascination with the number 11.

You may also be interested in:
• Why China is obsessed with numbers
• Why Icelanders believe in elves
• Switzerland’s new ‘criminal’ currency

Solothurn, founded by the Romans 2,000 years ago but forgotten by many visitors today due to its proximity to nearby capital Bern, is a town preoccupied with 11. It is neither a gimmick nor the result of coincidence, and the town is home to 11 churches, 11 chapels, 11 fountains, 11 towers and 11 museums – an astonishing architectural ensemble.

This collective ranges from the 15th Century to today. Some are time-worn and antiquated, some – in the case of ENTER, Switzerland’s only museum devoted to computers and technology – are resolutely modern. More often than not, bemused visitors do little more than gaze at the oldest building in the city, the astronomical clock, all set about with golden stars, orbs and moving figures of a king, knight and skeleton. But I wanted to delve deeper.

For her part, Stählin doesn’t claim to be any kind of expert numerologist, only an enthusiast. Her authority on the subject comes from growing up in the town and being happy to share her knowledge as a historian. “This story will never die,” she told me as we watched the 11-hour clock finish its chimes. “But now, we must get going – you still have to see our numerical masterpiece.”

Heading down Judengasse, or Jew’s Street, past a striking building once home to the Blacksmith’s Guild – one of the town’s 11 medieval societies – it was not long before we reached what Stählin was talking about: the magnificent Cathedral of St Ursus, resplendent in the midday sunshine.

Here, the number 11 is alive in the magnificent heritage site at an almost inconceivable level. It was built, somewhat predictably, in 11 years, and conceived by Italian architect Gaetano Matteo Pisoni, who impregnated the building with a multitude of symbols and signs. The cathedral hints at some cryptic element in the process of its creation, but also at numerical sequences that ultimately add up to something far more powerful.

Eleven represents the dream of trying to attain something better

Standing in front of its Romanesque façade, what strikes the onlooker is the calculated brilliance behind the cathedral’s frame. There are 11 rows of steps, followed by another 11, then a third set. There are two classical fountains flanking the staircase – one of Gideon and one of a devil-horned Moses – each adorned with 11 fine taps that trickle water into basins below in the heat of summer. There are 11 doors, while the structure’s height is split into three parts – of 11m each – and it is all dominated by the 66m-high belfry. That this tower hides a carillon of bells just shy of a dozen should come as no surprise.

“Pisoni ran riot with the idea,” said Stählin, as if still bewildered by the concept after all these years. “He was ordered by the government at the time to include the number 11. And he did. Everywhere. Even one of the altars is made from 11 types of marble.”

Anywhere else, the town cathedral would hum with the chit-chat of visitors. Not here. It is as if Solothurn has fallen out of history and been forgotten. Inside, it was just me, my guide and the echoes of our footfalls crossing the nave as we walked to the 11th flag stone, laid at the heart of the building and the only place from where you can see the cathedral’s 11 altars. I noticed the pews were also arranged in rows of 11.

Everyone in Solothurn knows this story, of course, but no-one can remember exactly how or why their hometown became so obsessed. A folk legend speaks of magical elves coming from nearby Weissenstein mountain to hearten the town’s inhabitants who worked hard, but never prospered. The adoption of the number 11, or ‘elf’ in German, was the townsfolk’s tribute to their saviours. Or so the tall tale goes.

A far more reasonable explanation is the number’s biblical connotations, with many Solothurn inhabitants deeming 11 to be a ‘holy’ number and prophetic. In numerology, 11 is considered the most intuitive of all numbers, commonly associated with faith and psychics, but the beliefs held by the faithful at the Cathedral of St Ursus are equally compelling.

“There were 12 apostles, but 11 represents the dream of trying to attain something better,” Stählin said, closing the door behind us and heading back into the daylight. “For us, it symbolises our never-ending pursuit of perfection – it is a cipher for hope.”

If religion is one strand of Solothurn’s numerological DNA, geopolitics is another. Throughout history, further echoes of the number can be traced back to the Late Middle Ages, without having to look too hard to find a pattern. In 1481, Solothurn became the 11th canton of the Swiss Confederation, and by the 16th-Century, the canton had been divided into 11 protectorates. What’s more, the first time the number is mentioned, back in 1252, the guilds that first voted for the town’s council elected 11 members.

It is impossible to fully understand the mindset of medieval Solothurn, but the number comes naturally to the town now. It is especially fascinating to learn that children enjoy a special celebration on their 11th birthday. Likewise, Confiserie Hofer, a bakery now in its 100th year, has the aptly named 11-i chocolate bar, while the abstract concept has become an opportunity swiftly seized on by the town’s flagship brewery.

“My father is from Bern and he had never heard of the ‘11 story’,” said brewmaster Moritz Künzle, while showing me the family brewery – Öufi-Bier, or ‘Eleven Beer’ in the local dialect – a short walk from Solothurn’s centre. “But we liked the idea of a number as a brand. It’s unusual and memorable. We were the first to do it, but there is now an ‘11’ this and an ‘11’ that. It’s growing every year.” An 11-year-old whisky matured in beer barrels is in the works, too.

For more than 500 years, Solothurn has developed an extraordinary alliance with the number 11. It is all too much to be an accident, and in the years to come, it may continue in the same way. And to think: one week ago, it would just have been another number.

Join more than three million BBC Travel fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Culture, Capital and Travel, delivered to your inbox every Friday.