{"id":1303,"date":"2021-02-23T22:05:14","date_gmt":"2021-02-23T22:05:14","guid":{"rendered":"https:\/\/www.ipocomputer.com\/lpc_en\/?p=1303"},"modified":"2021-04-21T02:29:01","modified_gmt":"2021-04-21T02:29:01","slug":"problem-3","status":"publish","type":"post","link":"https:\/\/retalhos.net\/ipocomputer\/2021\/02\/problem-3\/","title":{"rendered":"PROBLEM 3"},"content":{"rendered":"<blockquote>\n<h4>Problem: <span style=\"color: #808080;\">Calculation of the check digit<\/span><\/h4>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff6600;\"><strong><span class=\"\">Read a card file (ends with \/ * col 1-2) with CPF numbers and check the validity<\/span>.<\/strong><\/span><\/p>\n<blockquote><p>Calculation of the check digit of the CPF (BR &#8211; Registration physical personer), issued by the Federal Revenue Service.<\/p>\n<p>The CPF number has 9 digits plus two check digits, which are indicated after a slash. Therefore, a CPF has 11 digits. The CPF number is written in the form ABCDEFGHI \/ JK or directly as ABCDEFGHIJK, where the figures cannot all be the same.<\/p>\n<p><span class=\"\">The<strong><span style=\"color: #ff0000;\"> J<\/span><\/strong> is called the 1st check digit of the CPF number.<\/span><\/p>\n<p>The <span style=\"color: #800080;\"><strong>K<\/strong><\/span> is called the 2nd digit of the CPF number.<\/p>\n<p><strong><span style=\"color: #ff0000;\">First Digit<\/span><\/strong><\/p>\n<p>To obtain <strong><span style=\"color: #ff0000;\">J<\/span><\/strong>, we multiply A, B, C, D, E, F, G, H and I by the corresponding constants:<\/p>\n<table border=\"0\" width=\"322\" cellspacing=\"0\">\n<colgroup span=\"9\" width=\"20\"><\/colgroup>\n<tbody>\n<tr>\n<td align=\"center\" height=\"5\">A<\/td>\n<td align=\"center\">B<\/td>\n<td align=\"center\">C<\/td>\n<td align=\"center\">D<\/td>\n<td align=\"center\">E<\/td>\n<td align=\"center\">F<\/td>\n<td align=\"center\">G<\/td>\n<td align=\"center\">H<\/td>\n<td align=\"center\">I<\/td>\n<\/tr>\n<tr>\n<td align=\"center\" height=\"17\">x10<\/td>\n<td align=\"center\">x9<\/td>\n<td align=\"center\">x8<\/td>\n<td align=\"center\">x7<\/td>\n<td align=\"center\">x6<\/td>\n<td align=\"center\">x5<\/td>\n<td align=\"center\">x4<\/td>\n<td align=\"center\">x3<\/td>\n<td align=\"center\">x2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The result of the sum, 10A + 9B + 8C + 7D + 6E + 5F + 4G + 3H + 2I, is divided by 11.<\/p>\n<p>We then analyze the REST of that division:<\/p>\n<p>If it is 0 or 1, the digit J is [0] (zero). If it is 2, 3, 4, 5, 6, 7, 8, 9 or 10, the digit J is [11 &#8211; REST]<\/p>\n<p><span style=\"color: #800080;\"><strong>Second Digit<\/strong><\/span><\/p>\n<p>We already have <strong><span style=\"color: #ff0000;\">J<\/span><\/strong>. To obtain<span style=\"color: #800080;\"><strong> K<\/strong><\/span>, we multiply A, B, C, D, E, F, G, H, I and J by the corresponding constants:<\/p>\n<table border=\"0\" cellspacing=\"0\">\n<colgroup span=\"10\" width=\"40\"><\/colgroup>\n<tbody>\n<tr>\n<td align=\"center\" height=\"17\">A<\/td>\n<td align=\"center\">B<\/td>\n<td align=\"center\">C<\/td>\n<td align=\"center\">D<\/td>\n<td align=\"center\">E<\/td>\n<td align=\"center\">F<\/td>\n<td align=\"center\">G<\/td>\n<td align=\"center\">H<\/td>\n<td align=\"center\">I<\/td>\n<td align=\"center\"><span style=\"color: #ff0000;\">J<\/span><\/td>\n<\/tr>\n<tr>\n<td align=\"center\" height=\"17\">x11<\/td>\n<td align=\"center\">x10<\/td>\n<td align=\"center\">x9<\/td>\n<td align=\"center\">x8<\/td>\n<td align=\"center\">x7<\/td>\n<td align=\"center\">x6<\/td>\n<td align=\"center\">x5<\/td>\n<td align=\"center\">x4<\/td>\n<td align=\"center\">x3<\/td>\n<td align=\"center\">x2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The result of the sum, 11A + 10B + 9C + 8D + 7E + 6F + 5G + 4H + 3I + 2J, is divided by 11.<\/p>\n<p>We then verify the REST of that division:<\/p>\n<p>If it is 0 or 1, the digit <span style=\"color: #800080;\"><strong>K<\/strong><\/span> is [0] (zero). If it is 2, 3, 4, 5, 6, 7, 8, 9 or 10, the <strong><span style=\"color: #800080;\">K<\/span><\/strong> digit is [11 &#8211; REST].<\/p><\/blockquote>\n<\/blockquote>\n<div id=\"s3gt_translate_tooltip_mini\" class=\"s3gt_translate_tooltip_mini_box\" style=\"background: initial !important; border: initial !important; border-radius: initial !important; border-spacing: initial !important; border-collapse: initial !important; direction: ltr !important; flex-direction: initial !important; font-weight: initial !important; height: initial !important; letter-spacing: initial !important; min-width: initial !important; max-width: initial !important; min-height: initial !important; max-height: initial !important; margin: auto !important; outline: initial !important; padding: initial !important; position: absolute; table-layout: initial !important; text-align: initial !important; text-shadow: initial !important; width: initial !important; word-break: initial !important; word-spacing: initial !important; overflow-wrap: initial !important; box-sizing: initial !important; display: initial !important; color: inherit !important; font-size: 13px !important; font-family: X-LocaleSpecific, sans-serif, Tahoma, Helvetica !important; line-height: 13px !important; vertical-align: top !important; white-space: inherit !important; left: 535px; top: 837px; opacity: 0;\">\n<div id=\"s3gt_translate_tooltip_mini_logo\" class=\"s3gt_translate_tooltip_mini\" title=\"Traduzir o texto selecionado\"><\/div>\n<div id=\"s3gt_translate_tooltip_mini_sound\" class=\"s3gt_translate_tooltip_mini\" title=\"Reproduzir\"><\/div>\n<div id=\"s3gt_translate_tooltip_mini_copy\" class=\"s3gt_translate_tooltip_mini\" title=\"Copiar texto para \u00e1rea de transfer\u00eancia\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Problem: Calculation of the check digit &nbsp; Read a card file (ends with \/ * col 1-2) with CPF numbers and check the validity. Calculation [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/posts\/1303"}],"collection":[{"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/comments?post=1303"}],"version-history":[{"count":14,"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/posts\/1303\/revisions"}],"predecessor-version":[{"id":1336,"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/posts\/1303\/revisions\/1336"}],"wp:attachment":[{"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/media?parent=1303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/categories?post=1303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/tags?post=1303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}