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.

A027387 Write digits for n, count endpoints (version 2).

This page as a plain text file.
%I A027387 #26 Jul 16 2025 14:26:21
%S A027387 0,2,2,2,4,2,1,2,0,1,2,4,4,4,6,4,3,4,2,3,2,4,4,4,6,4,3,4,2,3,2,4,4,4,
%T A027387 6,4,3,4,2,3,4,6,6,6,8,6,5,6,4,5,2,4,4,4,6,4,3,4,2,3,1,3,3,3,5,3,2,3,
%U A027387 1,2,2,4,4,4,6,4,3,4,2,3,0
%N A027387 Write digits for n, count endpoints (version 2).
%C A027387 Number of endpoints: 0,8 - zero, 6,9 - one, 1,2,3,5,7 - two, 4 - four. - _Michael B. Porter_, Oct 28 2017
%H A027387 Paolo Xausa, <a href="/A027387/b027387.txt">Table of n, a(n) for n = 0..10000</a>
%F A027387 a(10*n + d) = a(n) + e where e is the number of endpoints of single digit d. - _David A. Corneth_, Oct 28 2017
%e A027387 The digit 1 has two endpoints, and the digit 8 has no endpoints, so a(18) = 2. - _Michael B. Porter_, Oct 28 2017
%t A027387 A027387[n_] := Total[Map[{0, 2, 2, 2, 4, 2, 1, 2, 0, 1}[[#+1]] &, IntegerDigits[n]]];
%t A027387 Array[A027387, 100, 0] (* _Paolo Xausa_, Jul 16 2025 *)
%o A027387 (PARI) a(n)=vecsum(apply(d->[0, 2, 2, 2, 4, 2, 1, 2, 0, 1][d+1], digits(n))); \\ based on program for A027386 by _Andrew Howroyd_, _Michael B. Porter_, Oct 26 2017
%Y A027387 Cf. A027386, A027388, A027389, A055642, A100910, A102683, A268643.
%K A027387 nonn,base
%O A027387 0,2
%A A027387 _N. J. A. Sloane_
%E A027387 a(6) corrected by _Michael B. Porter_, Oct 28 2017 (per _Andrew Howroyd_)
%E A027387 a(27) to a(80) by _Michael B. Porter_, Oct 28 2017