login
A340671
a(n) is the number of values m such that, if the first n positive integers are arranged in alphabetical order in US English, the m-th term in the order is equal to m.
2
1, 2, 1, 1, 0, 0, 0, 1, 0, 0, 2, 2, 3, 2, 0, 1, 0, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 3, 1, 2, 1, 2, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 1, 1, 2, 0, 1, 0, 1, 0
OFFSET
1,2
COMMENTS
Nonnegative integers can be used instead of positive integers, since zero will always be the last element alphabetically and will not change the sequence of the other integers.
This sequence uses standard US English names for numbers. "and" is not used, e.g., 101 is rendered as "one hundred one" rather than "one hundred and one".
a(n) is equivalent to the number of terms in the n-th row of A124172 for which the term in the k-th column is equal to k.
For n < 100, a(n) + 2 = a(200 + n). This is because a(200) = 2, and the numbers starting with "two hundred" will follow all of 1-199 alphabetically, so the range [201, 200 + n] will be in the same order as [1, n]. Similarly, because a(2000) = 4, for n < 999, a(n) + 4 = a(2000 + n). [Editor's note: It is unclear how the author finds a(2000) = 4. Both versions mentioned below give a(2000) = 2. - M. F. Hasler, Jul 05 2024]
From Claudio Meller, Hans Havermann and Michael S. Branicky, Jul 03 2024: (Start)
A formalization of Philip Cohen's solution to "Alphabetizing the Integers" in (Eckler, p. 20).
When alphabetizing in the b-file and a-file, the space is assumed to precede any letter, so EIGHT HUNDRED comes before EIGHTEEN. No commas are used, but hyphens are used. (End)
At least two variants of this sequence are conceivable, depending on whether spaces and hyphens are considered or ignored, when sorting the English names of the numbers. If spaces are considered, "eight hundred" comes before "eighteen"; if they are ignored, "eighteen" comes only after all of "eight hundred ...". The two variants would not differ until a(815), where "eighteen" would be the only "fixed point" (i.e., listed at the 18th place) in the first variant, but not in the second variant (where it is listed in the 2nd place, after "eight"). - M. F. Hasler, Jul 05 2024
LINKS
Michael S. Branicky and Hans Havermann, Table of n, a(n) for n = 1..10000
A. Ross Eckler, Alphabetizing the Integers (Word Ways, 1981, Vol. 14, No. 1, pp. 18-20).
Hans Havermann and Michael S. Branicky, n, Set of Fixed Points for n = 1..10000
EXAMPLE
a(1) = 1 ({one}, the 1st term is 1);
a(2) = 2 ({one, two}, the 1st term is 1 and the 2nd term is 2);
a(3) = 1 ({one, three, two}, the 1st term is 1);
a(4) = 1 ({four, one, three, two}, the 3rd term is 3);
a(11) = a(12) = 2 (the 4th term is 4 and the 7th term is 7);
a(13) = 3 (the 4th term is 4, the 7th term is 7, and the 12th term is 12).
PROG
(Python)
from num2words import num2words
def a(n):
sorted_list = sorted([num2words(m) for m in range(1, n+1)])
return sum(m == num2words(sorted_list.index(m)+1) for m in sorted_list)
print([a(n) for n in range(1, 101)]) # [Note: this program retains the "and" and commas. - Michael S. Branicky, Jul 05 2024]
(Python) # see link for faster version
from bisect import insort
from num2words import num2words
from itertools import count, islice
def n2w(n): # remove " and" and commas
return num2words(n).replace(" and", "").replace(", ", " ")
def agen(): # generator of terms
names = [] # a sorted list
for n in count(1):
insort(names, (n2w(n), n-1))
fixed = [j+1 for j in range(n) if names[j][1] == j]
yield len(fixed) # use "yield fixed" for list of fixed points
print(list(islice(agen(), 87))) # Michael S. Branicky, Jul 05 2024
(PARI) apply( {A340671(n, cf=English)=sum(i=1, #n=vecsort([1..n], x->cf(x), 1), n[i]==i)}, [1..99]) \\ See A052360 for English(). To get the "ignore spaces and hyphens" variant, use "CF(x)=[c|c<-Vecsmall(English(x)), c>64]" as 2nd optional argument. To get the list of fixed points, replace "sum(i=1, (...))" by "[i|i<-[1..(...)]". - M. F. Hasler, Jul 05 2024
CROSSREFS
KEYWORD
nonn,word
AUTHOR
Mikhail Soumar, Jan 15 2021
STATUS
approved