Skip to content

Instantly share code, notes, and snippets.

@paulmakepeace
Created December 30, 2011 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulmakepeace/1536879 to your computer and use it in GitHub Desktop.
Save paulmakepeace/1536879 to your computer and use it in GitHub Desktop.
Which European country's phone calling code requires the longest search into π?
https://twitter.com/#!/paulmakepeace/status/152405728848650240
"I mulled over this: which European country's phone calling code requires the longest search into π?
E.g. Switzerland +41, 3 digits #math #pi"
A couple of folks asked about very small "countries" or territories that
had seemingly long calling codes but which are actually subsumed under
e.g. North American Numbering Plan (+1) which isn't in Europe anyway,
Vatican City (+379 & +39), Curaçao (+599-9) under Netherlands Caribbean,
etc.
{"Moldova", 5230}
offsetInPi[s_List] :=
Position[Partition[RealDigits[N[Pi, 10000]][[1]], Length[s], 1],
s][[1, 1]]
europeCallingCodes = {#,
ToExpression[Characters[CountryData[#, "CallingCode"]]]} & /@
CountryData["Europe"]
First[Sort[
Cases[europeCallingCodes,
x_ :> {x[[1]], offsetInPi[x[[2]]]}], #1[[2]] > #2[[2]] &]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment