The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A371510 Number of swaps needed to bubble-sort the US English name of n. 1
4, 3, 2, 8, 1, 3, 1, 5, 2, 4, 2, 4, 9, 16, 16, 10, 13, 17, 11, 13, 5, 21, 14, 34, 21, 25, 16, 30, 29, 27, 3, 20, 11, 32, 18, 23, 12, 28, 27, 25, 0, 15, 7, 25, 11, 17, 8, 22, 20, 21, 1, 13, 7, 25, 10, 15, 7, 21, 17, 16, 2, 18, 12, 31, 18, 21, 11, 26, 25, 23, 6, 22, 15, 35, 22, 25, 16, 29, 30, 28, 2, 14, 8, 26, 13, 18, 8, 22, 19, 17, 4, 16, 10, 30, 15, 22, 12, 24, 26, 21, 28 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
COMMENTS
No swaps involve hyphens or spaces.
LINKS
Eric Angelini and Nicolas Graner, More bubble sorting, personal blog, March 2024.
EXAMPLE
For n=0, "zero" requires a(0) = 4 swaps of adjacent letters to reach ascending alphabetical order: ZERO-->EZRO-EZOR-EOZR-EORZ.
PROG
(Python)
from num2words import num2words
def a(n):
s = [c for c in num2words(n).replace(" and", "") if c.isalpha()]
L, c, swap = list(s), 0, True
while swap:
swap = False
for i in range(len(L)-1):
if L[i] > L[i+1]:
L[i], L[i+1], c, swap = L[i+1], L[i], c+1, True
return c
print([a(n) for n in range(101)]) # Michael S. Branicky, Mar 25 2024
CROSSREFS
Cf. A371478 (fixed points).
Sequence in context: A307648 A067016 A022295 * A258415 A132668 A018866
KEYWORD
base,nonn,word
AUTHOR
Eric Angelini and Nicolas Graner, Mar 25 2024
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 18 12:18 EDT 2024. Contains 372630 sequences. (Running on oeis4.)