cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A350131 Number of segments lit to display the number n on a 9-segment display used by the Russian postal service.

This page as a plain text file.
%I A350131 #53 Nov 20 2024 09:52:20
%S A350131 6,3,4,4,4,5,5,3,7,5,9,6,7,7,7,8,8,6,10,8,10,7,8,8,8,9,9,7,11,9,10,7,
%T A350131 8,8,8,9,9,7,11,9,10,7,8,8,8,9,9,7,11,9,11,8,9,9,9,10,10,8,12,10,11,8,
%U A350131 9,9,9,10,10,8,12,10,9,6,7,7,7,8,8,6,10,8
%N A350131 Number of segments lit to display the number n on a 9-segment display used by the Russian postal service.
%H A350131 Bartlomiej Malarz, <a href="/A350131/b350131.txt">Table of n, a(n) for n = 0..99999</a>
%H A350131 Wikipedia, <a href="https://en.wikipedia.org/wiki/Postal_codes_in_Russia#/media/File:Russian_postal_codes.svg">Postal code template</a>.
%H A350131 Wikipedia, <a href="https://en.wikipedia.org/wiki/Postal_codes_in_Russia">Postal codes in Russia</a>.
%e A350131 The Russian postal service uses a special template for entering postal codes, which makes automatic sorting of their parcels faster. It has nine segments, and digits looks like this (please check the first link in the Links section for a more readable, graphical example):
%e A350131 ._       _   _         _        _   _    _
%e A350131 | |  /|   |  /_  |_|  |_   /_   /  |_|  |_|
%e A350131 |_|   |  /_   /    |   _|  |_|  |  |_|   /
%e A350131 The template for a single digit contains nine segments: four vertical, three horizontal and two diagonal:
%e A350131 Vertical      Horizontal      Diagonal
%e A350131                    _
%e A350131    | |             _              /
%e A350131    | |             _              /
%e A350131 Using a combination of vertical, horizontal and/or diagonal segments, it is possible to create digits:
%e A350131 .
%e A350131                   number of segments
%e A350131          =====================================
%e A350131   digit  total  vertical  horizontal  diagonal
%e A350131   -----  -----  --------  ----------  --------
%e A350131     0      6        4          2          0
%e A350131     1      3        2          0          1
%e A350131     2      4        1          2          1
%e A350131     3      4        0          2          2
%e A350131     4      4        3          1          0
%e A350131     5      5        2          3          0
%e A350131     6      5        2          2          1
%e A350131     7      3        1          1          1
%e A350131     8      7        4          3          0
%e A350131     9      5        2          2          1
%t A350131 Table[Total[IntegerDigits[n]/.{0->6, 1->3, 2->4, 3->4, 6->5, 7->3, 8->7, 9->5}], {n, 0, 79}] (* _Stefano Spezia_, Dec 17 2021 *)
%o A350131 (PHP)
%o A350131 <?php
%o A350131 $segments = [6, 3, 4, 4, 4, 5, 5, 3, 7, 5];
%o A350131 $maxvalue = 100;
%o A350131 for ($i = 0; $i <= $maxvalue; $i++) {
%o A350131     $usedSegments = array_sum(array_map(fn($n) => $segments[$n], str_split($i)));
%o A350131     echo $usedSegments . "\n";
%o A350131 } // Simplified by _Bartlomiej Malarz_, Oct 30 2024
%o A350131 (Python)
%o A350131 segments = [6, 3, 4, 4, 4, 5, 5, 3, 7, 5]
%o A350131 def a(n): return sum(segments[int(d)] for d in str(n))
%o A350131 print([a(n) for n in range(80)]) # _Michael S. Branicky_, Dec 22 2021
%Y A350131 Cf. A006942, A010371, A063720, A074458.
%Y A350131 Cf. A350177 (histogram).
%K A350131 nonn,base
%O A350131 0,1
%A A350131 _Bartlomiej Malarz_, Dec 16 2021