是否有一种方法可以构建一组具有相同功能的整数,这些功能易于构造但难以猜测?
作为标题,是否有一种方法可以构建一个易于构造但难以猜测的整数组(约100,000件)?
例如,我认为构建了一些14位整数,让他们的所有14位数字的总和全部为70是一个好主意。但是,很难构造(似乎是NP问题),而且很容易猜测。这样我就没有主意。
提前致谢。
As the title, is there a way to construct a group (about 100,000 pieces) of integers with a same feature that are easy to construct but difficult to guess?
For example, I thought constructing some 14-digit integers and let their sums of all 14 digits are all 70 is a good idea. However, it is hard to construct (seems like it is a NP problem) and easy to guess. So that I do not have an idea.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个建议,使您的想法更进一步。
创建一个外观的14位数字,数字总和等于预期的14个随机数字,即14*4.5 = 63。
使用大小14的整数阵列并分配一个随机数字(并分配一个随机数字(在0到9之间到每个索引位置。然后以1步的随机索引位置增加/减少数字,直到数字总和变为63(确保数字保持在0到9之间)。
现在,使事情变得更加晦涩,我们像以前一样为阵列分配14个随机数字。但是,这次,我们让第14位数字指出了我们不触及的数字的数组位置。然后,我们计算剩余的12个数字的数字总和,就像以前一样,将其调整为预期的平均值,该平均值为12*4.5 = 54。
因此,如果省略14'数字并指出的数字时,数字总和为54,则14位数字是有效的。这个数字将显示随机,很容易生成,而且很难猜测。此外,很容易手动检查有效性,这可能是一个优势。
Here is a suggestion that takes your idea one step further.
It is not NP-hard to create a random-looking 14-digit number with a digit sum equal to the expected average of 14 random digits, namely 14*4.5 = 63.
Use an integer array of size 14 and assign a random digit (between 0 and 9) to each index position. Then increment/decrement the digits at random index positions in steps of 1 until the digit sum becomes 63 (ensuring the digits stay between 0 and 9).
Now, making things more obscure, we assign 14 random digits to the array as before. This time, however, we let the 14'th digit point out the array position of a digit we leave untouched. We then calculate the digit sum of the 12 remaining digits and, as before, adjust it to the expected average, which is 12*4.5 = 54 this time.
So the 14-digit number is valid if the digit sum is 54 when omitting the 14'th digit and the digit it points out. The number will appear random, is easy to generate, and quite hard to guess. Furthermore, it is easy to check manually for validity, which may be an advantage.