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-10 of 10 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

A052360 Number of characters in the English name of n, including 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, 10, 10, 12, 11, 11, 10, 12, 12, 11, 6, 10, 10, 12, 11, 11, 10, 12, 12, 11, 5, 9, 9, 11, 10, 10, 9, 11, 11, 10, 5, 9, 9, 11, 10, 10, 9, 11, 11, 10, 5, 9, 9, 11, 10, 10, 9, 11, 11, 10, 7, 11, 11, 13, 12, 12, 11, 13
Offset: 0

Views

Author

Allan C. Wechsler, Mar 07 2000

Keywords

Comments

See A007005 for the French analog, and A167507 for the "count letters only" variant (analog of A005589). - M. F. Hasler, Sep 20 2014

Examples

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

Crossrefs

Programs

  • Maple
    a:= n-> length(convert(n, english)):
    seq(a(n), n=0..100);  # Alois P. Heinz, Jul 30 2023
  • PARI
    English(n, pot=[10^9,"billion", 10^6,"million", 1000,"thousand", 100,"hundred"])={ n>99 && forstep( i=1,#pot,2, n999 && error("n >= 1000 ",pot[2]," not yet implemented");
    return( Str( English(n[1])," ",pot[i+1], if( n[2], Str(" ",English(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],
      Str([ "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" ][n\10-1], if( n%10, Str("-",English(n%10)),"")))}
    A052360(n)=#English(n)  \\ M. F. Hasler, Jul 26 2011
    
  • Python
    from num2words import num2words
    def a(n): return len(num2words(n).replace(" and", "").replace(chr(44), ""))
    print([a(n) for n in range(78)]) # Michael S. Branicky, Jul 12 2022

Extensions

Minor edits by Ray Chandler, Jul 22 2009

A134629 Least nonnegative integer which requires n letters to spell in English, excluding spaces and hyphens. A right inverse of A005589.

Original entry on oeis.org

1, 0, 3, 11, 15, 13, 17, 24, 23, 73, 101, 104, 103, 111, 115, 113, 117, 124, 123, 173, 323, 373, 1104, 1103, 1111, 1115, 1113, 1117, 1124, 1123, 1173, 1323, 1373, 3323, 3373, 11373, 13323, 13373, 17373, 23323, 23373, 73373, 101373, 103323, 103373, 111373, 113323, 113373, 117373, 123323, 123373
Offset: 3

Views

Author

Robert G. Wilson v, Nov 04 2007

Keywords

Comments

Variant of A080777. - R. J. Mathar, Dec 13 2008
This is one of many possible right inverses of A005589, i.e., A005589 o A134629 = id (of course on the domain of this sequence, [3 .. oo)). It does not satisfy A134629 o A005589 = id. - M. F. Hasler, Feb 25 2018

Examples

			a(3) = 1: "one", a(4) = 0: "zero", a(5) = 3: "three", a(6) = 11: "eleven", a(7) = 15: "fifteen", etc.
		

Crossrefs

Programs

Extensions

More terms and reworded name from M. F. Hasler, Feb 25 2018

A052362 Indices of records in length of English name of n including spaces and dashes (A052360): n such that k < n => A052360(k) < A052360(n).

Original entry on oeis.org

0, 3, 11, 13, 17, 21, 23, 73, 101, 103, 111, 113, 117, 121, 123, 173, 323, 373, 1101, 1103, 1111, 1113, 1117, 1121, 1123, 1173, 1323, 1373, 3323, 3373, 11373, 13323, 13373, 17373, 21373, 23323, 23373, 73373, 101323, 101373, 103323, 103373, 111373, 113323, 113373, 117373
Offset: 1

Views

Author

Allan C. Wechsler, Mar 07 2000

Keywords

Comments

From M. F. Hasler, Aug 12 2020: (Start)
This sequence uses A052360 which counts all characters in the English name of the numbers, including spaces and hyphens, in contrast to A052363 which uses A005589 which only counts the letters. Thus, e.g., "twenty-one" is in this sequence but not in A052363.
It appears that from 1323 on, all terms end in -323 or in -373. After 117(373) these are prefixed by 121, 123, 173, 323, 373 (thousand). Then the next terms is 1'103'323, and after 1'373'373, the next terms are > 3*10^6, then > 11*10^6, etc.
I conjecture that from 103 on all d-digit terms have a smaller (most often but not always (d-1)-digit) term as suffix, and from 173 on they also have an earlier term as prefix. (End)

Examples

			From _M. F. Hasler_, Aug 12 2020: (Start)
The first term is zero, since all other nonnegative integers (thus certainly all those with longer names) are larger than zero.
"One" and "two" are not in the sequence, since "zero" is smaller but has a longer name.
"Three" is again in the sequence since all smaller numbers (0, 1 and 2) have shorter names. And so on. (End)
		

Crossrefs

Programs

  • PARI
    m=0;for(n=0,2e5, if(m<A052360(n), m=A052360(n); print1(n", "))) \\ M. F. Hasler, Aug 12 2020
    
  • Python
    from itertools import count, islice
    from num2words import num2words as n2w
    def f(n): return len(n2w(n).replace(" and", "").replace(chr(44), ""))
    def agen():
        record = 0
        for n in count(0):
            value = f(n)
            if value > record: yield n; record = value
    print(list(islice(agen(), 46))) # Michael S. Branicky, Jul 12 2022

Extensions

Minor edits by Ray Chandler, Jul 22 2009
Name and example edited and more terms by M. F. Hasler, Aug 12 2020

A067278 a(n) = letters(n) + a(n-1); a(0) = 0.

Original entry on oeis.org

0, 3, 6, 11, 15, 19, 22, 27, 32, 36, 39, 45, 51, 59, 67, 74, 81, 90, 98, 106, 112, 121, 130, 141, 151, 161, 170, 181, 192, 202, 208, 217, 226, 237, 247, 257, 266, 277, 288, 298, 303, 311, 319, 329, 338, 347, 355, 365, 375, 384, 389, 397, 405, 415, 424, 433, 441
Offset: 0

Views

Author

Scott A. Brown, Feb 22 2002

Keywords

Examples

			0 + one = 3, 3 + two = 6, 6 + three = 11, 11 + four = 15, 15 + five = 19, ....
		

Crossrefs

Formula

a(n) = A005589(n) + a(n-1). - Michael S. Branicky, Mar 03 2025

A119960 Positive integers with prime number of characters in their English names, including spaces and hyphens.

Original entry on oeis.org

1, 2, 3, 6, 7, 8, 10, 15, 16, 24, 25, 29, 34, 35, 39, 40, 43, 47, 48, 50, 53, 57, 58, 60, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 84, 85, 89, 94, 95, 99
Offset: 1

Views

Author

Jonathan Vos Post, Aug 02 2006

Keywords

Comments

Differs due to hyphens and spaces from A072685 Positive integers whose English names contain a prime number of letters. Primes with prime number of characters in their English names, including spaces and hyphens, are a subset of this beginning: 2, 3, 7, 29, 43, 47, 53, 67, 71, 73.

Crossrefs

Programs

  • Mathematica
    Select[Range[99], PrimeQ[ StringLength@ IntegerName[#, "Words"]] &] (* Giovanni Resta, Jun 13 2016 *)

Formula

n such that A052360(n) is prime. n such that A052360(n) is in A000040.

Extensions

Missing a(1) and more terms from Giovanni Resta, Jun 13 2016

A082655 Number of distinct letters needed to spell English names of numbers 1 through n.

Original entry on oeis.org

3, 5, 7, 9, 11, 13, 13, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
Offset: 1

Views

Author

Peter F. Klammer (pklammer(AT)acm.org), May 17 2003

Keywords

Comments

Late increases are at twentY, hunDred, thousAnd, Million, Billion, Quadrillion, sePtillion, oCtillion.
Only J and K are never used for English number names. Z is used only for zero.

Examples

			"One" has three letters, "two" brings two new letters (t w), "three" brings two more (h r)...
		

Crossrefs

Extensions

Edited by Don Reble, Nov 03 2003
More terms from Jinyuan Wang, Apr 07 2020

A089585 Records in A005589.

Original entry on oeis.org

4, 5, 6, 8, 9, 11, 12, 13, 15, 16, 18, 19, 21, 22, 23, 24, 26, 27, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68
Offset: 1

Views

Author

Eric W. Weisstein, Nov 09 2003

Keywords

Comments

Values of n that achieve records are in A052363.

Crossrefs

Extensions

a(1) corrected by Georg Fischer, Jun 24 2020

A132204 Sum of the numerical equivalents for the 23 Latin letters, according to Tartaglia, of the letters in the English name of n, excluding spaces and hyphens.

Original entry on oeis.org

2341, 351, 0, 940, 0, 296, 81, 665, 1011, 431, 500
Offset: 0

Views

Author

Jonathan Vos Post, Nov 19 2007

Keywords

Comments

Which are the fixed points n such that a(n) = n? Which n have prime a(n)? What are the equivalence classes of integers that have the same a(n)? Which n divide a(n)? Which n have a(n) that can be read as binary, as with a(8) = 1011? What is the sequence of n such that a(n) = 0 (i.e. the English name on n contains a J, U, or W)?
This sequence seems unnatural, since English uses three letters that were not in the Latin alphabet (W, U, J). A better sequence would first write the names of the numbers in Latin (cf. A132984) and then sum the values of the letters. - N. J. A. Sloane, Nov 30 2007

Examples

			a(0) = A132475(ZERO) = A132475(Z)+A132475(E)+A132475(R)+A132475(O) = 2000 + 250 + 80 + 11 = 2341.
a(1) = A132475(ONE) = A132475(O)+A132475(N)+A132475(E) = 11 + 90 + 250 = 351.
a(2) = 0 because "TWO" contains a "W" which is not one of Tartaglia's letters.
a(3) = A132475(THREE) = 160 + 200 + 80 + 250 + 250 = 940.
a(4) = 0 because "FOUR" contains a "U" which is not one of Tartaglia's letters.
a(5) = A132475(FIVE) = 40 + 1 + 5 + 250 = 296.
a(6) = A132475(SIX) = 70 + 1 + 10 = 81.
a(7) = A132475(SEVEN) = 70 + 250 + 5 + 250 + 90 = 665.
a(8) = A132475(EIGHT) = 250 + 1 + 400 + 200 + 160 = 1011.
a(9) = A132475(NINE) = 90 + 1 + 90 + 250 = 431.
a(10) = A132475(TEN) = 160 + 250 + 90 = 500 = A132475(Q).
		

Crossrefs

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
Showing 1-10 of 10 results.