[seqfan] Mathematica code in A080777
Hans Havermann
gladhobo at bell.net
Sun Jun 13 19:21:03 CEST 2021
One of the "features" of Mathematica 12 was a correction of IntegerName[n,"Words"] which previously had provided incorrect power names for numbers >= 10^102 (adding a spurious "s" pluralization). While not at play in A080777, another feature of the function had/has been to use
"‐" as the hyphen separator (in numbers like 21). The StringReplace function in Ivan's code has instead a "hyphen-minus" ("-") which will give an incorrect result. One can fix this by replacing said hyphen-minus with "\[Hyphen]".
I don't know if this was Ivan's fault or simply the way an edit using a pasted "‐" shows up. For example, the edit of the StringReplace also has a comma deletion which ends up looking like a comma-space deletion because (I guess) OEIS will always add a space after a comma, even when it is in code. I don't think the comma-space deletion affects the program run however, possibly because StringReplace may work simultaneously, not sequentially (left-to-right).
I've been looking for a better way to find the total number of letters in an IntegerName expression than by deletion of those commas, spaces, and hyphens. While it seems a bit circuitous, Total[LetterCounts[IntegerName[c,"Words"]]] seems to work. So,
f=48; Do[c=1; While[Total[LetterCounts[IntegerName[c,"Words"]]]!=i, c++]; Print[c], {i,3,f}]
will print out the correct sequence to a(48).
More information about the SeqFan
mailing list