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.

Showing 1-5 of 5 results.

A005589 Number of letters in the US English name of n, excluding spaces and hyphens.

Original entry on oeis.org

4, 3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, 6, 8, 8, 7, 7, 9, 8, 8, 6, 9, 9, 11, 10, 10, 9, 11, 11, 10, 6, 9, 9, 11, 10, 10, 9, 11, 11, 10, 5, 8, 8, 10, 9, 9, 8, 10, 10, 9, 5, 8, 8, 10, 9, 9, 8, 10, 10, 9, 5, 8, 8, 10, 9, 9, 8, 10, 10, 9, 7, 10, 10, 12, 11, 11, 10, 12, 12, 11, 6, 9, 9, 11, 10, 10, 9, 11, 11, 10, 6, 9, 9, 11, 10, 10, 9, 11, 11, 10, 10, 13, 13, 15, 14, 14, 13, 15, 15, 14, 13, 16, 16, 18, 18, 17, 17, 19, 18, 18, 16
Offset: 0

Views

Author

Keywords

Comments

Diane Karloff observes (Nov 27 2007) that repeatedly applying the map k->A005589(k) to any starting value n always leads to 4 (cf. A016037, A133418).
The above observation was previously made in 1972 by R. Schroeppel and R. W. Gosper in HAKMEM (Item 134). - Bartlomiej Pawlik, Jun 12 2023
For terms beyond a(100), this sequence uses the US English style, "one hundred one" (not "one hundred and one"), and the short scale (a billion = 10^9, not 10^12). - M. F. Hasler, Nov 03 2013
Explanation of Diane Karloff's observation above: In many languages there exists a number N, after which all numbers are written with fewer letters than the number itself. N is 4 in English, German and Bulgarian, and 11 in Russian. If in the interval [1,N] there are numbers equal to the number of their letters, then they are attractors. In English and German the only attractor is 4, in Bulgarian 3, in Russian there are two, 3 and 11. In the interval [1,N] there may also exist loops of numbers, for instance 4 and 6 in Bulgarian (6 and 4 letters respectively) or 4,5 and 6 in Russian (6,4 and 5 letters respectively). There are no loops in English, therefore the above observation is true. - Ivan N. Ianakiev, Sep 20 2014

Examples

			Note that A052360(373373) = 64 whereas a(373373) = 56.
		

References

  • Problems Drive, Eureka, 37 (1974), 8-11 and 33.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A362123 for another version.
Cf. A007208 (analog for German).

Programs

  • Mathematica
    inWords[n_] := Module[{r,
    numNames = {"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"},
    teenNames = {"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"},
    tensNames = {"", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"},
    decimals = {"", "thousand", "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion", "septillion", "octillion", "nonillion", "decillion", "undecillion", "duodecillion", "tredecillion", "quattuordecillion", "quindecillion", "sexdecillion", "septendecillion", "octodecillion", "novemdecillion", "vigintillion", "unvigintillion", "duovigintillion", "trevigintillion", "quattuorvigintillion", "quinvigintillion", "sexvigintillion", "septenvigintillion", "octovigintillion", "novemvigintillion", "trigintillion", "untrigintillion", "duotrigintillion"}},
    r = If[# != 0, numNames[[# + 1]] <> "hundred"
    (* <> If[#2 != 0||#3 != 0," and",""] *),
    ""] <> Switch[#2, 0, numNames[[#3 + 1]], 1, teenNames[[#3 + 1]], _, tensNames[[#2 + 1]] <> numNames[[#3 + 1]]] & @@@
    (PadLeft[ FromDigits /@ Characters@ StringReverse@#, 3] & /@ StringCases[ StringReverse@ IntegerString@ n, RegularExpression["\\d{1,3}"]]);
    StringJoin@ Reverse@ MapThread[ If[# != "", StringJoin[##], ""] &, {r, Take[decimals, Length@ r]} ]]; (* modified for this sequence from what is presented in the link and good to 10^102 -1 *)
    f[n_] := StringLength@ inWords@ n; f[0] = 4; Array[f, 84, 0]
    (* Robert G. Wilson v, Nov 04 2007 and revised Mar 31 2015, small revision by Ivan Panchenko, Nov 10 2019 *)
    a[n_] := StringLength[ StringReplace[ IntegerName[n, "Words"], "," | " " | "\[Hyphen]" -> ""]]; a /@ Range[0, 83] (* Mma version >= 10, Giovanni Resta, Apr 10 2017 *)
  • PARI
    A005589(n, t=[10^12, #"trillion", 10^9, #"billion", 10^6, #"million", 1000, #"thousand", 100, #"hundred"])={ n>99 && forstep( i=1, #t, 2, n999 && error("n >= 10^",valuation(t[1],10)+3," requires extended 2nd argument"); return( A005589(n[1])+t[i+1]+if( n[2], A005589( n[2] )))); if( n<20, #(["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"][n+1]), #([ "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" ][n\10-1])+if( n%10, A005589(n%10)))}  \\ Extension of 2nd arg to larger numbers is easy using the names listed in Mathematica section above. Only the string lengths are required, so it's easy to extend this list further without additional knowledge and without writing out the names. - M. F. Hasler, Jul 26 2011, minor edit on Jun 15 2021
    
  • Python
    from num2words import num2words
    def a(n):
        x = num2words(n).replace(' and ', '')
        l = [chr(i) for i in range(97, 123)]
        return sum(1 for i in x if i in l)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jul 05 2017

Extensions

Corrected and extended by Larry Reeves (larryr(AT)acm.org) and Allan C. Wechsler, Mar 20 2000
Erroneous b-file deleted by N. J. A. Sloane, Sep 25 2008
More than the usual number of terms are shown in the DATA field to avoid confusion with A362123. - N. J. A. Sloane, Apr 20 2023

A133418 Let l(n) = number of letters in n, A005589(n). If l(n) = 4 set a(n) = 0; otherwise a(n) = a(l(n)) + 1.

Original entry on oeis.org

0, 2, 2, 1, 0, 0, 2, 1, 1, 0, 2, 3, 3, 2, 2, 2, 2, 1, 2, 2, 3, 1, 1, 4, 3, 3, 1, 4, 4, 3, 3, 1, 1, 4, 3, 3, 1, 4, 4, 3, 1, 2, 2, 3, 1, 1, 2, 3, 3, 1, 1, 2, 2, 3, 1, 1, 2, 3, 3, 1, 1, 2, 2, 3, 1, 1, 2, 3, 3, 1, 2, 3, 3, 4, 4, 4, 3, 4, 4, 4, 3, 1, 1, 4, 3, 3, 1, 4, 4, 3, 3, 1, 1, 4, 3, 3, 1, 4, 4, 3, 4, 3, 3, 3, 3
Offset: 0

Views

Author

N. J. A. Sloane, Nov 27 2007

Keywords

Comments

Based on the observation by Diane Karloff (see A005589) that the trajectory of l always converges to 4.
The smallest n with a(n) = 6 is 1103323373373373373373373373373 (one nonillion one hundred and three octillion ...) which has 323 letters.

Examples

			5 has four letters so a(5) = 0. 3 has five letters so a(3) = a(5) + 1 = 1.
		

Crossrefs

A variant of A016037.

A227290 Repeatedly map numbers to number of letters in English name (A005589); sequence gives first number that needs n steps to get to 4.

Original entry on oeis.org

4, 0, 3, 1, 11, 23, 323, 1103323373373373373373373373373
Offset: 0

Views

Author

Roland Kneer, Jul 05 2013

Keywords

Comments

Based on the observation by Diane Karloff that the trajectory of A005589 always converges to 4.
40311123323 (concatenation of the first seven terms) is the first time prime is obtained when concatenating k first initial terms of the sequence. - Jonathan Vos Post, Jul 06 2013, edited by Antti Karttunen, Jul 25 2013

Examples

			"eleven" has 6 letters, "six" has 3 letters, "three" has 5 letters, "five" has 4 letters.
So a(4)=11, as A005589^4(11)=4 and 11 is the first such number.
But a(3)=1, because "one" is the same length as "six".
		

Crossrefs

Cf. A016037.

A178823 a(1) = 1, a(n+1) = least k >= a(n) such that the sum of the number of letters in the English name of all values in the sequence through a(n), excluding spaces and hyphens (A005589), is prime.

Original entry on oeis.org

1, 4, 5, 11, 12, 13, 24, 73, 1103, 1115, 1117, 1117, 1117, 1117, 1117, 1140, 1144, 1201, 1217, 1217, 1323, 1326, 1340, 1344, 1374, 1413, 1413, 1413, 1413, 1424, 1441, 1441, 1480, 1484
Offset: 1

Views

Author

Jonathan Vos Post, Dec 26 2010

Keywords

Examples

			a(1) = 1 by definition.
a(2) = 4 because "one" plus "four" has 3 + 4 = 7 letters, with 7 prime.
a(3) = 5 because "one" plus "four" plus "five" gives 3 + 4 + 4 = 11, a prime.
a(4) = 11 because "one" plus "four" plus "five" plus "eleven" gives 3 + 4 + 4 + 6 = 17 is prime.
a(5) = 12 because "one" plus "four" plus "five" plus "eleven" plus "twelve" gives 3 + 4 + 4 + 6 + 6 = 23 is prime.
a(6) = 13 because "one" plus "four" plus "five" plus "eleven" plus "twelve" plus "thirteen" gives 3 + 4 + 4 + 6 + 6 + 8 = 31 is prime.
a(7) = 24 because "one" plus "four" plus "five" plus "eleven" plus "twelve" plus "thirteen" plus "twentyfour" gives 3 + 4 + 4 + 6 + 6 + 8 + 10 = 41 is prime.
a(8) = 73 because "one" plus "four" plus "five" plus "eleven" plus "twelve" plus "thirteen" plus "twentyfour" plus "seventythree" gives 3 + 4 + 4 + 6 + 6 + 8 + 10 + 12 = 53 is prime.
a(9) = 1103 because "one" plus "four" plus "five" plus "eleven" plus "twelve" plus "thirteen" plus "twentyfour" plus "seventythree" plus "one thousand one hundred three" gives 3 + 4 + 4 + 6 + 6 + 8 + 10 + 12 + 26 = 79 is prime.
a(10) = 1115 "one" plus "four" plus "five" plus "eleven" plus "twelve" plus "thirteen" plus "twentyfour" plus "seventythree" plus "one thousand one hundred three" plus "one thousand one hundred fifteen" gives 3 + 4 + 4 + 6 + 6 + 8 + 10 + 12 + 26 + 28 = 107 is prime.
		

Crossrefs

Extensions

a(11)-a(34) from Nathaniel Johnston, Jan 04 2011

A301408 Repeatedly map numbers to the number of letters in the English name (include spaces, but no hyphens and no "and"s); sequence gives smallest nonnegative integer that needs exactly n iterations to get to 4.

Original entry on oeis.org

4, 0, 3, 1, 11, 23, 123, 101323373373
Offset: 0

Views

Author

Keywords

Examples

			Since "twenty three" has 12 letters (including the space), "twelve" has 6 letters, "three" has 5 letters, "four" has four letters, and no other smaller nonnegative integer maps to 4 in exactly 5 iterations, then a(5) = 23.
		

References

  • M. Ecker, Number play, calculators, and card tricks: Mathemagical black holes, in E. Berlekamp and T. Rodgers, eds., The Mathemagician and Pied Puzzler: A Collection in Tribute to Martin Gardner, A. K. Peters, 1999, pp. 41-52.

Crossrefs

Cf. A227290, A005589, A016037 (these do not count the spaces in the names of larger integers).
Showing 1-5 of 5 results.