Advertisement
PO8

Social Engineering: Theory and Practice

PO8
May 14th, 2016
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.44 KB | None | 0 0
  1. Social Engineering: Theory and Practice
  2. PO8 <bart@cs.uoregon.edu>
  3. March 23, 1997
  4.  
  5. The Netrunner runner Prep card Social Engineering is an oft-used
  6. card: it provides both an early-game speedup and a way of
  7. dealing with particularly nasty ice in the late game. It,
  8. along with its early-game counterpart Inside Job, is an
  9. important runner-deck tool. However, Social Engineering
  10. suffers somewhat from a bad reputation. It is all too easy for
  11. the runner to lose more bits than they can afford at a critical
  12. time during the game. And yet, if the Runner risks too few
  13. bits, the chances of success are not very high.
  14.  
  15. The inventors of the branch of Mathematics known as Game Theory
  16. wanted to answering these very sorts of economic questions.
  17. Game Theory can tell us exactly how to play Social Engineering
  18. optimally in a given situation. In this article, I will
  19. describe these optimal strategies for Social Engineering, and
  20. give some suggestions about how to convert this theory into
  21. practice.
  22.  
  23. Here's the rules for Social Engineering, as taken from
  24. BitByte's (<adriant@greenie.com>) spoiler list
  25. (http://home.pacific.net.sg/~bitbyte).
  26.  
  27. Social Engineering: Prep (1) [1.0 U]
  28. Hide at least (2) from your pool in your hand; the Corp
  29. then guesses how many bits you hid. If the Corp guesses
  30. correctly, lose that many bits. Otherwise, choose a
  31. data fort and a piece of ICE on that fort. Then make a
  32. run on that fort, during which you automatically pass
  33. that piece of ICE.
  34.  
  35. Assume a pool of n bits. Then, let us choose to risk i bits
  36. [2 <= i <= n] with probability proportional to 1/i. We must
  37. normalize, so we are chosing to risk i bits with probability
  38. p(i) = (1/i) / (1/2 + 1/3 + ... + 1/n)
  39. Thus, when n = 5, we have probabilities
  40. i p(i)
  41. 2 0.39
  42. 3 0.26
  43. 4 0.19
  44. 5 0.15
  45. Now imagine that the corp chooses any pure strategy (i.e., it
  46. always guesses some particular number of bits). Its expected
  47. return on this strategy (i.e., the number of bits it expects to
  48. cost the runner due to guessing correctly) is identical.
  49. i e(i)
  50. 2 0.78
  51. 3 0.78
  52. 4 0.78
  53. 5 0.78
  54. In other words, no matter what pure strategy the corp picks, it
  55. will cost the runner 1.78 bits, on average, to play social
  56. engineering. It can be proven from this that any combination of
  57. pure corp strategies will achieve the same result, and thus
  58. this strategy is optimal for the runner (although the proof
  59. is outside the scope of this paper).
  60.  
  61. Unfortunately, the above "optimal" strategy is based on a
  62. fairly unrealistic assumption. Presumably the runner
  63. is playing this card because they will receive some utility
  64. from a successful run, not just to avoid losing bits.
  65. Unfortunately, there is no clear "value of being able to pass a
  66. selected piece of ice" in the game. Let us arbitrarily set
  67. this value at 3 bits, just to see how it affects our
  68. calculations. (Why 3 bits? Inside Job, which costs 2 bits,
  69. will let us pass the 1st piece of ice for free. Let us assume
  70. that the value of passing an arbitrary piece of ice is half
  71. again as much. We will generalize later in any case.)
  72.  
  73. We will now use a different strategy, namely; we will risk i
  74. bits with probability 1/i+3. Normalizing gives us
  75. p(i) = (1/(i+3)) / (1/5 + 1/6 + ... + 1/(n+3))
  76. When n = 5, we choose with probability
  77. i p(i)
  78. 2 0.32
  79. 3 0.26
  80. 4 0.23
  81. 5 0.20
  82. and the corp's expected return for their pure strategy
  83. (including the three bit benefit of preventing the run
  84. as well as the cost to the runner of being guessed and of
  85. playing the card) is
  86. i e(i)
  87. 2 2.6
  88. 3 2.6
  89. 4 2.6
  90. 5 2.6
  91. Thus, we have an optimal strategy for the runner under the new
  92. conditions, under which it will cost the runner about 2.6 bits,
  93. including the opportunity cost of missed runs, to play Inside
  94. Job. (There is some additional opportunity cost of playing a
  95. Prep during the run, but this is difficult to estimate and
  96. probably reasonably small in any case.) Note how much the
  97. probabilities have flattened out. Indeed, as the value to the
  98. corp of an unsuccessful run gets large, it swamps the expected
  99. value of making the runner lose the guess bits, and the
  100. runner's optimal strategy quickly converges on simply picking a
  101. random value uniformly from the range 2..n .
  102.  
  103. A natural question to ask about strategy involves asymptotic
  104. behavior: what is the optimal strategy as the size of the
  105. runner's bit pool n gets large?
  106. limit n->inf sum(i=2..n, 1/i)
  107. diverges, so the more bits the runner has, the better off they
  108. are. Notice that the expected return for the corp as a function
  109. of the runner's bit pool size n is
  110. e(n) = 1 + 1/(1/5 + 1/6 + ... + 1/(n+3))
  111. Obviously, the expected corp return converges on 1. But don't
  112. be fooled: the divergence of this "harmonic series" is notoriously
  113. slow. When n = 100 (surely infinity from most corps' point
  114. of view) we still have e(n)=1.32 .
  115.  
  116. Note that we picked a utility of 3 for a successful run fairly
  117. arbitrarily. Depending on the game situation, this utility
  118. estimate could be wildly off. E.g., you know there's a
  119. Political Overthrow in a fort, and it's protected by
  120. Filter-Filter-Colonel Failure. Your icebreakers are Codecracker
  121. and Raptor. How much would you be willing to pay for a
  122. Social? On the other hand, a Filter protects a Holovid
  123. Campaign, but you don't have any icebreakers yet. How much
  124. would you be willing to pay for a Social?
  125.  
  126. Fortunately, the calculations we have been performing
  127. generalize quite easily to the case of a u-bit utility:
  128. p(i,n,u) = (1/(i+u)) / (1/(2+u) + 1/(3+u) + ... + 1/(n+u))
  129. e(n,u) = 1 + 1/(1/(2+u) + 1/(3+u) + ... + 1/(n+u))
  130. One interesting way to pick the utility is to ask the card itself
  131. how much it values a run at! We do this by noting that the
  132. card is presumably zero-sum, and thus when e(n,u) = u presumably
  133. the corp expects to cost the runner exactly the amount that the
  134. runner expects to benefit from the run. Thus we need to solve
  135. 1 + 1/(1/(2+u) + 1/(3+u) + ... + 1/(n+u)) = u
  136. i.e.
  137. (1/(2+u) + 1/(3+u) + ... + 1/(n+u)) = 1/(u-1)
  138. for u. I don't see how to do this analytically, but numerically,
  139. we find the following:
  140. n u
  141. 2 *
  142. 3 4.5
  143. 4 3.0
  144. 5 2.4
  145. 6 2.1
  146. 7 2.0
  147. 8 1.9
  148. 9 1.8
  149. 10 1.8
  150. ...
  151. 100 1.3
  152. The * at n = 2 is because the equation for u is singular
  153. at this value, and thus no solution exists. Intuitively, this
  154. is because the corp will never guess wrong in this case, and so
  155. the runner is stupid to play the card! The fact that the u
  156. value is dependent on the size n of the runner bit pool is
  157. rather strange, but points up the fact that as the runner has
  158. more bits, his chances of using this card successfully just get
  159. better and better, and so a run made using the card is worth
  160. less and less.
  161.  
  162. Note that once the runner has 6 or more bits, the expected
  163. return when playing optimally (at u=3) doesn't change much as
  164. the bit pool increases. However, what does change is the risk
  165. of a disastrous outcome for the runner. It is true that the
  166. expected return for the corp if it always chooses n is exactly
  167. the same as if it always chooses 2. However, in the first
  168. case, if the corp guesses right, the runner loses all their
  169. bits. This will happen very rarely, but the runner may be
  170. risk-averse; willing to lose more on average to avoid the risk
  171. of major losses. Fortunately, limiting risk in this framework
  172. is easily accomplished: the runner can treat the pool as though
  173. it has only as many bits as the runner is willing to risk, and
  174. calculate accordingly. Again, the cost of this risk management
  175. becomes very high at 4 bits or below, and I don't advise it ---
  176. if losing 4 bits would be a disaster for the runner, the runner
  177. shouldn't be playing a Social Engineering at that point.
  178.  
  179. A final question is how to use our formulae in a game situation.
  180. If one is playing online, it's relatively straightforward to
  181. have a "Social Engineering bit picker" sitting in a window on
  182. one's terminal, which will select bit value b(n,u) from the
  183. appropriate probability distribution p(i,n,u). If one is
  184. playing head-to-head, it is possible to program a programmable
  185. calculator, PDA, etc., to perform this same calculation.
  186. Unfortunately, this may or may not be allowed by a tournament
  187. director, and it may be cumbersome and unpleasant in any case.
  188.  
  189. Lacking a programmable calculator or PDA, the runner could use
  190. a set of tables for d100, parameterized by n and u, to select
  191. bit values. These tables are included as Appendix A to this
  192. article. In fact, since it is highly desirable to screen the
  193. die roll used for this selection from the runner, a very
  194. reasonable approach is to glue the tables to the inside of a
  195. cardboard screen, behind which the dice are rolled and the bits
  196. selected.
  197.  
  198. What is really desired is an approximation or set of
  199. approximations using just ordinary die rolls and no difficult
  200. arithmetic, such that a selection reasonable approximating
  201. optimality can be quickly and unobtrusively carried out in a
  202. game situation. Unfortunately, I see no obvious rules of thumb
  203. for small n and/or u. For u >= 4 and n >= 5, however, it
  204. appears that the error induced by merely rolling a die and
  205. guessing as many bits as it says (rerolling if it is out of
  206. range) is fairly small. We can quantify the cost of this
  207. non-optimal strategy. The expected return for the corp is
  208. c(i) = (1 + i + u) * (1/(n-1) - p(i))
  209. where p(i) is the true probability that should be assigned to
  210. the i-th bit. It is clear that the corp's best bet is always
  211. to take i=n, and that the largest error obtains when u=4. It
  212. turns out that the error gets larger as n increases (which
  213. makes intuitive sense, since the runner is supposed to be
  214. getting a better and better deal, and isn't) but stays
  215. very close to 1/2 bit for a wide range of n and u values
  216. above n >= 5 and u >= 4. This is another interesting consequence
  217. of the slow divergence of the harmonic series --- we know that
  218. the error becomes infinite for large enough n, but when n=100,
  219. we still have error less than 0.72!
  220.  
  221. One unfortunate effect of this strategy, however, is that the
  222. optimal corp strategy is to guess the entire value of the bit
  223. pool. This might make a risk-averse runner very nervous,
  224. especially since this corp strategy gets slightly better as the
  225. size of the runner bit pool increases. An obvious way to
  226. counter this problem is to count die rolls of 1 as 2s: this
  227. overweights the value 2 at the expense of the other values. It
  228. turns out that the optimal corp strategy (again for n >= 5 and
  229. u >=4) is now to always guess 2. Fortunately, the expected
  230. corp gain over optimal strategy is still about 1/2 bit, and
  231. falls rapidly off as n increases (for fixed u).
  232.  
  233. All of the above is pretty abstract. Here's what I suggest
  234. as a runner strategy for Social Engineering, given that neither
  235. software nor tables are available:
  236. (1) Figure out how much the run is worth. Call this
  237. number u. If u is less than 3 bits, don't play the
  238. Social.
  239. (2) Figure out how many bits the pool will have after
  240. playing the social. Call this number n.
  241. (3) If n is more bits that the runner can safely lose,
  242. reduce n to the number of bits the runner can safely lose.
  243. (4) If n is 4 or less and u < 5, don't play the Social.
  244. (5) If n is greater than 6:
  245. (5a) Obtain or synthesize an m-sided die,
  246. with n > m.
  247. (5b) Reroll until the result r of the roll
  248. satisfies 1 <= r <= n.
  249. (5c) If r is 1, make r be two.
  250. (5d) Risk r bits.
  251. (6) Otherwise:
  252. (6b) Obtain a 6-sided die.
  253. (6c) Reroll until the result r of the roll
  254. satisfies 2 <= r <= n.
  255. (6d) Risk r bits.
  256. When written out like this, the algorithm looks pretty complicated.
  257. In point of fact, it's pretty straightforward once you get the hang
  258. of it.
  259.  
  260. One last obvious question is: what of the poor Corp? Well,
  261. the Runner has been careful to make any strategy yield
  262. pretty similar results. The Corp must simply pick randomly
  263. among the available strategies, in order to prevent the Runner
  264. guessing what's going to happen. Here's the algorithm I suggest
  265. for the Corp.
  266. (1) Figure out how many bits the pool will have after
  267. playing the social. Call this number n.
  268. (2) Figure out how many bits the runner can safely lose.
  269. If this is less than n, set n to this value + 1.
  270. (3) If the runner is playing with a table or device,
  271. use a die to select randomly from the range 2..n.
  272. (4) If n > 6, roll an m-sided die, and count any 1 result
  273. as a n, until the result r is in range. Guess r.
  274. (5) If n <= 6, roll a 6-sided die, and count any 1 result
  275. as a 2, until the result r is in range. Guess r.
  276. This isn't perfect, but is good enough in my opinion. There's
  277. a little game the runner can play with n vs. n - 1 and a large
  278. bit pool, but it hardly matters in this case anyhow.
  279.  
  280. So, how good a card is Social Engineering, anyhow? Looks like
  281. it's a little better deal than Inside Job in most cases: the
  282. extra 0.5-1.5 bit expected penalty for choosing an arbitrary
  283. piece of ice is pretty tasty in a lot of situations. (On the
  284. other hand, since Inside Job passes the 1st ice it encounters,
  285. it can be useful in situations where the Corp can't afford to
  286. rez more than 1 of the several pieces of ice on a fort. Ce'st
  287. La Vie.) Hopefully, this exposition will help Runners and
  288. Corps alike deal with Social Engineering, and encourage its use.
  289.  
  290. Appendix A: Guess Tables For Social Engineering
  291.  
  292. To use these tables: Find the table for the u value you are
  293. interested in, and go to the column for the n of the bit pool
  294. you have and are willing to risk. The e value, at the bottom,
  295. tells how much, including opportunity cost, this Social run
  296. will cost you. If this is acceptable, then play the Social,
  297. and roll d100. Pick the row whose entry in your chosen column
  298. is the largest value less than or equal to the die roll. Look
  299. to the left to see how many bits to risk.
  300.  
  301. u=0
  302. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  303. 02----59---45---37---33---30---28---26---24---23---22---21---21---20
  304. 03----99---75---63---56---51---47---44---42---40---38---37---36---34
  305. 04---------99---83---73---67---62---58---55---52---50---48---47---45
  306. 05--------------99---87---79---73---69---65---62---60---57---55---54
  307. 06-------------------99---90---83---78---74---70---67---65---63---61
  308. 07------------------------99---91---86---81---77---74---72---69---67
  309. 08-----------------------------99---92---88---84---80---77---75---73
  310. 09----------------------------------99---93---89---85---82---80---77
  311. 10---------------------------------------99---94---90---87---84---82
  312. 11--------------------------------------------99---95---91---88---86
  313. 12-------------------------------------------------99---95---92---89
  314. 13------------------------------------------------------99---95---93
  315. 14-----------------------------------------------------------99---96
  316. 15----------------------------------------------------------------99
  317. e= 2.20 1.92 1.78 1.69 1.63 1.58 1.55 1.52 1.50 1.48 1.46 1.44 1.43
  318.  
  319. u=1
  320. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  321. 02----56---41---34---29---26---24---22---20---19---18---18---17---16
  322. 03----99---73---60---52---46---42---39---37---35---33---32---31---30
  323. 04---------99---81---70---63---57---53---50---47---45---43---42---40
  324. 05--------------99---85---77---70---65---61---58---55---53---51---49
  325. 06-------------------99---88---81---75---70---67---64---61---59---57
  326. 07------------------------99---90---84---79---74---71---68---65---63
  327. 08-----------------------------99---92---86---81---78---74---72---69
  328. 09----------------------------------99---93---88---84---80---77---74
  329. 10---------------------------------------99---93---89---85---82---79
  330. 11--------------------------------------------99---94---90---87---84
  331. 12-------------------------------------------------99---94---91---88
  332. 13------------------------------------------------------99---95---92
  333. 14-----------------------------------------------------------99---95
  334. 15----------------------------------------------------------------99
  335. e= 2.71 2.28 2.05 1.92 1.82 1.75 1.70 1.66 1.62 1.60 1.57 1.55 1.53
  336.  
  337. u=2
  338. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  339. 02----54---39---31---27---24---21---20---18---17---16---15---15---14
  340. 03----99---71---58---49---44---40---36---34---32---30---29---28---27
  341. 04---------99---80---68---60---55---50---47---44---42---40---38---37
  342. 05--------------99---84---75---68---63---58---55---52---50---48---46
  343. 06-------------------99---87---79---73---68---64---61---58---56---54
  344. 07------------------------99---89---82---77---72---69---66---63---60
  345. 08-----------------------------99---91---85---80---76---72---69---67
  346. 09----------------------------------99---92---87---82---78---75---72
  347. 10---------------------------------------99---93---88---84---81---78
  348. 11--------------------------------------------99---93---89---86---82
  349. 12-------------------------------------------------99---94---90---87
  350. 13------------------------------------------------------99---94---91
  351. 14-----------------------------------------------------------99---95
  352. 15----------------------------------------------------------------99
  353. e= 3.22 2.62 2.32 2.13 2.00 1.91 1.84 1.79 1.74 1.71 1.67 1.65 1.62
  354.  
  355. u=3
  356. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  357. 02----53---38---30---25---22---20---18---17---16---15---14---13---13
  358. 03----99---70---56---48---42---38---34---32---30---28---27---26---24
  359. 04---------99---79---67---59---53---48---45---42---40---38---36---35
  360. 05--------------99---84---74---66---61---56---53---50---47---45---43
  361. 06-------------------99---87---78---72---66---62---59---56---53---51
  362. 07------------------------99---89---81---76---71---67---64---61---58
  363. 08-----------------------------99---90---84---79---74---71---68---65
  364. 09----------------------------------99---91---86---81---77---74---71
  365. 10---------------------------------------99---92---87---83---79---76
  366. 11--------------------------------------------99---93---89---85---81
  367. 12-------------------------------------------------99---94---90---86
  368. 13------------------------------------------------------99---94---90
  369. 14-----------------------------------------------------------99---95
  370. 15----------------------------------------------------------------99
  371. e= 3.73 2.96 2.58 2.34 2.18 2.07 1.98 1.91 1.86 1.81 1.77 1.74 1.71
  372.  
  373. u=4
  374. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  375. 02----52---37---29---24---21---19---17---16---15---14---13---12---12
  376. 03----99---70---55---46---41---36---33---30---28---27---25---24---23
  377. 04---------99---78---66---57---51---47---43---40---38---36---34---33
  378. 05--------------99---83---73---65---59---55---51---48---46---44---42
  379. 06-------------------99---86---77---70---65---61---57---54---52---50
  380. 07------------------------99---88---81---75---70---66---62---59---57
  381. 08-----------------------------99---90---83---78---73---69---66---63
  382. 09----------------------------------99---91---85---80---76---73---69
  383. 10---------------------------------------99---92---87---82---78---75
  384. 11--------------------------------------------99---93---88---84---80
  385. 12-------------------------------------------------99---93---89---85
  386. 13------------------------------------------------------99---94---90
  387. 14-----------------------------------------------------------99---94
  388. 15----------------------------------------------------------------99
  389. e= 4.23 3.30 2.83 2.55 2.36 2.22 2.12 2.03 1.97 1.91 1.86 1.83 1.79
  390.  
  391. u=5
  392. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  393. 02----52---36---28---24---20---18---16---15---14---13---12---12---11
  394. 03----99---69---54---46---40---35---32---29---27---26---24---23---22
  395. 04---------99---78---65---57---50---46---42---39---37---35---33---32
  396. 05--------------99---83---72---64---58---54---50---47---44---42---40
  397. 06-------------------99---86---77---70---64---60---56---53---50---48
  398. 07------------------------99---88---80---74---69---65---61---58---55
  399. 08-----------------------------99---90---83---77---72---68---65---62
  400. 09----------------------------------99---91---85---80---75---72---68
  401. 10---------------------------------------99---92---86---82---78---74
  402. 11--------------------------------------------99---93---88---83---80
  403. 12-------------------------------------------------99---93---89---85
  404. 13------------------------------------------------------99---94---90
  405. 14-----------------------------------------------------------99---94
  406. 15----------------------------------------------------------------99
  407. e= 4.73 3.64 3.09 2.75 2.53 2.37 2.25 2.15 2.07 2.01 1.96 1.91 1.87
  408.  
  409. u=6
  410. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  411. 02----51---36---28---23---20---17---16---14---13---12---12---11---10
  412. 03----99---69---54---45---39---34---31---28---26---25---23---22---21
  413. 04---------99---77---64---56---50---45---41---38---36---34---32---30
  414. 05--------------99---82---71---63---57---53---49---46---43---41---39
  415. 06-------------------99---85---76---69---63---59---55---52---49---47
  416. 07------------------------99---88---79---73---68---64---60---57---54
  417. 08-----------------------------99---89---82---76---72---67---64---61
  418. 09----------------------------------99---91---84---79---74---71---67
  419. 10---------------------------------------99---92---86---81---77---73
  420. 11--------------------------------------------99---92---87---83---79
  421. 12-------------------------------------------------99---93---88---84
  422. 13------------------------------------------------------99---94---89
  423. 14-----------------------------------------------------------99---94
  424. 15----------------------------------------------------------------99
  425. e= 5.24 3.98 3.34 2.96 2.70 2.52 2.38 2.27 2.18 2.11 2.05 1.00 1.95
  426.  
  427. u=7
  428. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  429. 02----51---35---27---23---19---17---15---14---13---12---11---10---10
  430. 03----99---68---53---44---38---34---30---28---26---24---22---21---20
  431. 04---------99---77---64---55---49---44---40---37---35---33---31---30
  432. 05--------------99---82---71---63---57---52---48---45---42---40---38
  433. 06-------------------99---85---75---68---63---58---54---51---48---46
  434. 07------------------------99---87---79---72---67---63---59---56---53
  435. 08-----------------------------99---89---82---76---71---67---63---60
  436. 09----------------------------------99---90---84---78---74---70---67
  437. 10---------------------------------------99---91---85---81---76---73
  438. 11--------------------------------------------99---92---87---82---78
  439. 12-------------------------------------------------99---93---88---84
  440. 13------------------------------------------------------99---93---89
  441. 14-----------------------------------------------------------99---94
  442. 15----------------------------------------------------------------99
  443. e= 5.74 4.31 3.60 3.16 2.87 2.67 2.51 2.39 2.29 2.20 2.14 2.08 2.03
  444.  
  445. u=8
  446. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  447. 02----51---35---27---22---19---17---15---14---12---12---11---10---10
  448. 03----99---68---53---44---38---33---30---27---25---23---22---21---20
  449. 04---------99---77---63---55---48---43---40---37---34---32---30---29
  450. 05--------------99---82---70---62---56---51---47---44---42---39---37
  451. 06-------------------99---85---75---68---62---57---53---50---48---45
  452. 07------------------------99---87---79---72---67---62---58---55---53
  453. 08-----------------------------99---89---81---75---70---66---63---59
  454. 09----------------------------------99---90---83---78---73---69---66
  455. 10---------------------------------------99---91---85---80---76---72
  456. 11--------------------------------------------99---92---87---82---78
  457. 12-------------------------------------------------99---93---88---83
  458. 13------------------------------------------------------99---93---89
  459. 14-----------------------------------------------------------99---94
  460. 15----------------------------------------------------------------99
  461. e= 6.24 4.65 3.85 3.37 3.04 2.81 2.64 2.50 2.39 2.30 2.22 2.16 2.10
  462.  
  463. u=9
  464. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  465. 02----51---35---27---22---19---16---15---13---12---11---10---10---09
  466. 03----99---68---53---43---37---33---29---27---25---23---21---20---19
  467. 04---------99---76---63---54---48---43---39---36---34---31---30---28
  468. 05--------------99---81---70---62---55---51---47---44---41---39---37
  469. 06-------------------99---85---75---67---61---57---53---50---47---44
  470. 07------------------------99---87---78---72---66---62---58---55---52
  471. 08-----------------------------99---89---81---75---70---66---62---59
  472. 09----------------------------------99---90---83---78---73---69---65
  473. 10---------------------------------------99---91---85---80---75---72
  474. 11--------------------------------------------99---92---86---82---77
  475. 12-------------------------------------------------99---93---87---83
  476. 13------------------------------------------------------99---93---88
  477. 14-----------------------------------------------------------99---94
  478. 15----------------------------------------------------------------99
  479. e= 6.74 4.98 4.09 3.57 3.21 2.96 2.77 2.62 2.50 2.40 2.31 2.24 2.18
  480.  
  481. u=10
  482. b= n=03 n=04 n=05 n=06 n=07 n=08 n=09 n=10 n=11 n=12 n=13 n=14 n=15
  483. 02----51---34---26---22---18---16---14---13---12---11---10---10---09
  484. 03----99---68---52---43---37---32---29---26---24---22---21---20---19
  485. 04---------99---76---63---54---47---42---39---36---33---31---29---28
  486. 05--------------99---81---70---61---55---50---46---43---40---38---36
  487. 06-------------------99---84---74---67---61---56---52---49---46---44
  488. 07------------------------99---87---78---71---66---61---57---54---51
  489. 08-----------------------------99---89---81---74---69---65---61---58
  490. 09----------------------------------99---90---83---77---72---68---65
  491. 10---------------------------------------99---91---85---79---75---71
  492. 11--------------------------------------------99---92---86---81---77
  493. 12-------------------------------------------------99---92---87---83
  494. 13------------------------------------------------------99---93---88
  495. 14-----------------------------------------------------------99---93
  496. 15----------------------------------------------------------------99
  497. e= 7.24 5.32 4.35 3.77 3.38 3.10 2.89 2.73 2.60 2.49 2.40 2.32 2.26
  498.  
  499. Appendix B: Algorithms Used In This Article
  500.  
  501. Here are the algorithms I used in computing the numbers used in
  502. the article, including the tables of Appendix A. They are
  503. written for Keith Packard's "nick" interactive calculator, but
  504. should be fairly understandable without it.
  505.  
  506. function norm(n,u) {
  507. auto i;
  508. auto s = 0;
  509. for (i = 2; i <= n; i++)
  510. s += 1/(i+u);
  511. return s;
  512. }
  513.  
  514. function p(i,n,u) {
  515. return (1/(i+u)) / norm(n,u);
  516. }
  517.  
  518. function ex(n,u) {
  519. return 1 + 1/norm(n,u);
  520. }
  521.  
  522. function dd(i,n,u) {
  523. auto j;
  524. auto s = 0;
  525. for (j = 2; j <= i; j++)
  526. s += p(j,n,u);
  527. return s;
  528. }
  529.  
  530. function d(i,n,u) {
  531. return floor(dd(i,n,u) * 100) - 1;
  532. }
  533.  
  534. function er(i,n,u) {
  535. return (1 + i + u) * (1/(n-1) - p(i,n,u));
  536. }
  537.  
  538. function er2(i,n,u) {
  539. auto k = 1 + i + u;
  540. if (i == 2)
  541. return k * (2/n - p(i,n,u));
  542. else
  543. return k * (1/n - p(i,n,u));
  544. }
  545.  
  546. function normtest(n,u) {
  547. auto i;
  548. auto s = 0;
  549. for (i = 2; i <= n; i++)
  550. s += p(i,n,u);
  551. return s;
  552. }
  553.  
  554. function printtab(u,nn) {
  555. auto i, n;
  556. printf("u=%d\n", u);
  557. printf("b= ");
  558. for (n = 3; n <= nn; n++)
  559. printf(" n=%02d", n);
  560. printf("\n");
  561. for (i = 2; i <= nn; i++) {
  562. printf("%02d-", i);
  563. for (n = 3; n <= nn; n++)
  564. if (i <= n)
  565. printf("---%02d", d(i,n,u));
  566. else
  567. printf("-----");
  568. printf("\n");
  569. }
  570. printf("e= %4.2f", ex(3,u));
  571. for (n = 4; n <= nn; n++)
  572. printf(" %4.2f", ex(n,u));
  573. printf("\n");
  574. }
  575.  
  576. function printtabs(nu,nn) {
  577. auto i;
  578. printtab(0,nn);
  579. for (i = 1; i <= nu; i++) {
  580. printf("\n");
  581. printtab(i,nn);
  582. }
  583. }
  584.  
  585. /* printtabs(10,15) */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement