cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A007208 Number of letters in German name of n.

Original entry on oeis.org

4, 4, 4, 4, 4, 4, 5, 6, 4, 4, 4, 3, 5, 8, 8, 8, 8, 8, 8, 8, 7, 13, 14, 14, 14, 14, 15, 16, 14, 14, 7, 13, 14, 14, 14, 14, 15, 16, 14, 14, 7, 13, 14, 14, 14, 14, 15, 16, 14, 14, 7, 13, 14, 14, 14, 14, 15, 16, 14, 14, 7, 13, 14, 14, 14, 14, 15, 16, 14, 14, 7
Offset: 0

Views

Author

Keywords

Comments

Standard German orthography; a letter with an umlaut or ß is counted as a single letter: e.g., 30 maps to length("dreißig") = 7.
There are ambiguities from n=100 on, since both, "hundert" and "einhundert" are equally valid and common. The same applies for 1000 with "tausend" or "eintausend". - M. F. Hasler, Nov 03 2013
In contrast to English (A005589 vs A052360) and French (A007005 vs A167507), there are no spaces or other punctuation in German names for numbers, until 10^6 = "eine Million". - M. F. Hasler, Sep 20 2014
There also appears to be an ambiguity on whether there is an 's' in the middle of 101*10^3, "(ein)hundertein(s)tausend". - M. F. Hasler, Apr 08 2023

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A005589 and A052360 (English analog).
Cf. A007005 and A167507 (French analog).

Programs

  • PARI
    /* Because names with ä, ö, ü or ß can't be entered directly as a string in the GP interface, we use a separate list for the names, for efficiency and readability of the main function. Note that the default lexicographical order is that of ISO 8859-1 character codes ("z" < "ß" < "ä"). In applications where this is not suitable, the special characters below can be replaced, e.g., with "ae, oe, ue, ss" or "a, o, u, s". [M. F. Hasler, Jul 05 2024] */
    {deutsch = ["eins", "zwei", "drei", "vier", Str("f"Strchr(252)"nf"), "sechs", "sieben", "acht", "neun", "zehn", "elf", Str("zw"Strchr(246)"lf"),  "dreizehn", "vierzehn", Str("f"Strchr(252)"nfzehn"), "sechzehn", "siebzehn", "achtzehn", "neunzehn", "zwanzig", Str("drei"Strchr(223)"ig"), "vierzig", Str("f"Strchr(252)"nfzig"), "sechzig", "siebzig", "achtzig", "neunzig"]}
    German(n, e="eins", power=0, name="")={ if(power /* internal helper function */
      , n = divrem(n, power); Str(German(n[1], e) name, if(n[2], German(n[2]), ""))
      , n < 20, if(n>1, deutsch[n], n, e, "null")
      , n < 100, Str(if(n%10, Str(German(n%10, "ein") "und"), "") deutsch[n\10+18])
      , n < 1000, German(n, "ein", 100, "hundert") \\ replace "ein" with "" to get
      , n < 10^6, German(n, "ein", 1000, "tausend")\\ hundert/tausend without "ein-"
      , my(t=3); while(n>=10^t, t+=3); German(n, "ein", 10^t-=3, strprintf(
          if(n\10^t>1, " %sen", t%2, "e %se", "e %s")  if(n%10^t, " ", ""),
          Str(["M", "B", "Tr", "Quadr", "Quint", "Sext", "Sept", "Oct", "Non",
               "Dez", "Undez" /* etc. */][t\6], "illi", ["on", "ard"][t%2+1])))
      )} \\ updated Mar 03 2020, Apr 08 2023, Jul 05 2024
    A007208 = n -> #German(n) \\ M. F. Hasler, Nov 01 2013
    A007208(n) = vecsum([c>32|c<-Vecsmall(German(n))]) \\ To exclude spaces; irrelevant for n < 10^6. - M. F. Hasler, Jul 05 2024

Extensions

Corrected by Markus Stausberg (markus(AT)polomi.de), Aug 08 2004
Initial term a(0) = 4 = #"null" added by M. F. Hasler, Nov 01 2013