{"id":1305,"date":"2021-02-23T22:09:05","date_gmt":"2021-02-23T22:09:05","guid":{"rendered":"https:\/\/www.ipocomputer.com\/lpc_en\/?p=1305"},"modified":"2021-04-21T02:38:32","modified_gmt":"2021-04-21T02:38:32","slug":"solution-problem-3","status":"publish","type":"post","link":"https:\/\/retalhos.net\/ipocomputer\/2021\/02\/solution-problem-3\/","title":{"rendered":"SOLUTION PROBLEM 3"},"content":{"rendered":"<blockquote>\n<h4>Problem: <span style=\"color: #808080;\">Calculation of the check digit<\/span><\/h4>\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<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<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<hr \/>\n<h4 style=\"text-align: right;\"><strong><span style=\"color: #999999;\">Waiting suggestions before publishing the <span style=\"color: #ff6600;\">Solution<\/span>\u00a0 &#8230;<\/span><br \/>\n<\/strong><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>Problem: Calculation of the check digit Read a card file (ends with \/ * col 1-2) with CPF numbers and check the validity. Calculation of [&#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":[7],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/posts\/1305"}],"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=1305"}],"version-history":[{"count":9,"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/posts\/1305\/revisions"}],"predecessor-version":[{"id":1868,"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/posts\/1305\/revisions\/1868"}],"wp:attachment":[{"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/media?parent=1305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/categories?post=1305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/retalhos.net\/ipocomputer\/wp-json\/wp\/v2\/tags?post=1305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}