数字序列可最大程度地减少输入时通过未命中键获得有效数字的风险 [英] Number sequences which minimise the risk of getting a valid number through a miss-key when inputted

查看:81
本文介绍了数字序列可最大程度地减少输入时通过未命中键获得有效数字的风险的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



很快我可能会被序列化成千上万个用整数标记它们的设备.

编号的目的是允许通过在手机上通过接口输入分配给它的编号来激活该设备.该过程与真实货币交易有关,因此将意外激活错误设备的风险降至最低至关重要.

我希望分配给设备的数字不是连续的,所以向上或向下移动一个数字不会激活另一台设备.

键盘是标准数字键盘,数字8下方的底部为0.

我想最大程度地降低单个错键激活错误设备的风险.

因此,没有一个遗漏键会意外按下任何相邻的数字键来匹配有效的设备ID.我很乐意忽略有两个错过键的比赛.

所以我想这对于该组的数学家来说是一个更大的问题.

一个例子...

如果有效的设备ID为12345.其中2和4与1相邻,则22345和42345将从可能的设备ID列表中排除.

是否可以使用数学方法生成此列表,还是我必须编写一个例程,该例程以第一个数字(例如10000)开头,然后从那里开始根据这些规则测试序列中的每个数字是否存在冲突? class ="h2_lin">解决方案

我会稍作更改,方法是在数字的开头或末尾添加一个校验位:
如果您使用(数字总和加位数位数字)以10为模,那么您将不可能因为一个简单的错误而得到相同的校验位.这也可以防止转置数字:例如12435而不是12345.


Hi,

Soon I may be required to serialise many thousands of devices labelling them with an integer number.

The purpose of the number is to allow the device to be activated by entering the number assigned to it via an interface on a mobile phone. The process relates to real money transactions and therefore minimising the risk of accidentally activating the wrong device is essential.

I want the numbers assigned to the devices to be none sequential so going one number up or down doesn''t activate another device.

The keypad is a standard numeric pad with 0 at the bottom below the number 8.

I want to minimise the risk of a single miss-key activating the wrong device.

So no single miss-key where by accidentally pressing any adjacent number key would match a valid device id. I''m happy to ignore matches where there are two miss-keys.

So I''m guessing this is more a question for the mathematicians of the group.

An example...

If a valid device ID was 12345. Where 2 and 4 are adjacent to 1, 22345 and 42345 would be excluded from the list of possible device ids.

Is there a way to generate this list using mathematical techniques or will I have to write an routine which starts with the first number, say 10000, and then work up from there testing each number in the sequence for clashes based on these rules?

解决方案

I would change it slightly, by putting a check digit either at the start or end of the number:
If you use a (sum-of-digits plus digit-position-number) modulo 10 then your are unlikely to get the same check digit by a simple mistake. This would also protect against transposed digits: 12435 instead of 12345 for example.


这篇关于数字序列可最大程度地减少输入时通过未命中键获得有效数字的风险的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆