是否有可能建立一个算法产生autogram?有可能、建立一个、算法、autogram

2023-09-11 06:08:17 作者:少年,别回头。

这是 autogram 是一个句子描述它所包含的字符,通常列举的每一个字母字母,但可能还包含的标点符号。这是在维基页面给出的例子。

An autogram is a sentence which describes the characters it contains, usually enumerating each letter of the alphabet, but possibly also the punctuation it contains. Here is the example given in the wiki page.

这句话采用了两个一的,两个C的,二D的,28鄂氏,5架F的三G的,八H公司,十一我的,三L的两个M的,十三N为,九点钟的,两个p的,五个R的, 25的s,23吨的,六五世的,十W公司,两个X的,五ÿ的,和一个Z。

This sentence employs two a’s, two c’s, two d’s, twenty-eight e’s, five f’s, three g’s, eight h’s, eleven i’s, three l’s, two m’s, thirteen n’s, nine o’s, two p’s, five r’s, twenty-five s’s, twenty-three t’s, six v’s, ten w’s, two x’s, five y’s, and one z.

想出一个是很难的,因为你不知道有多少信件包含直到说完这句话。这正是促使我问:是否有可能写一个算法,它可以创建一个autogram?例如,给定参数将是句子的开始为输入如这句话采用了,并假设它使用相同的格式上面的x一个的,... Y Z的

Coming up with one is hard, because you don't know how many letters it contains until you finish the sentence. Which is what prompts me to ask: is it possible to write an algorithm which could create an autogram? For example, a given parameter would be the start of the sentence as an input e.g. "This sentence employs", and assuming that it uses the same format as the above "x a's, ... y z's".

我不要求你实际编写的算法,但通过各种手段我很想看看,如果你知道一个存在,或想尝试写一个;而我很好奇,这个问题是否是可计算摆在首位。

I'm not asking for you to actually write an algorithm, although by all means I'd love to see if you know one to exist or want to try and write one; rather I'm curious as to whether the problem is computable in the first place.

推荐答案

您问两个不同的问题。

"is it possible to write an algorithm which could create an autogram?"

有算法找到autograms。据我所知,他们使用的随机化的,这意味着该算法可能会发现对于给定的起始文本中的溶液,但如果它没有找到一个,那么这并不意味着没有一个。这把我们带到了第二个问题。

There are algorithms to find autograms. As far as I know, they use randomization, which means that such an algorithm might find a solution for a given start text, but if it doesn't find one, then this doesn't mean that there isn't one. This takes us to the second question.

"I'm curious as to whether the problem is computable in the first place."

可计算将意味着,有一种算法,对于给定的起始文本要么输出一个解决方案,或者说没有一个。上述算法不能做到这一点,和穷举搜索不可行。所以我说,这个问题是不可计算的。但是,这是相当具有学术意义。在实践中,随机算法工作不够好。

Computable would mean that there is an algorithm which for a given start text either outputs a solution, or states that there isn't one. The above-mentioned algorithms can't do that, and an exhaustive search is not workable. Therefore I'd say that this problem is not computable. However, this is rather of academic interest. In practice, the randomized algorithms work well enough.