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.

A342845 Number of distinct even numbers visible as proper substrings of n.

This page as a plain text file.
%I A342845 #12 Mar 26 2021 06:32:48
%S A342845 0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,2,1,1,1,2,1,2,1,2,1,1,0,1,0,
%T A342845 1,0,1,0,1,0,2,1,2,1,1,1,2,1,2,1,1,0,1,0,1,0,1,0,1,0,2,1,2,1,2,1,1,1,
%U A342845 2,1,1,0,1,0,1,0,1,0,1,0,2,1,2,1,2,1,2,1,1,1,1,0,1,0,1,0,1,0,1,0,2,2,3,2,3
%N A342845 Number of distinct even numbers visible as proper substrings of n.
%C A342845 Here substrings must be contiguous.
%H A342845 Reinhard Zumkeller, <a href="/A342845/b342845.txt">Table of n, a(n) for n = 0..10000</a>
%H A342845 Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a342/A342845.java">Java program</a> (github)
%e A342845 a(10)=1 because we can form 0.
%e A342845 a(24)=2 because we can form 2, 4.
%e A342845 a(102)=3 because we can form 0, 2, 10.
%e A342845 a(124)=4 because we can form the following even numbers: 2, 4, 12, 24.
%o A342845 (Haskell)
%o A342845 import Data.List (isInfixOf)
%o A342845 a045887 n = length $ filter (`isInfixOf` (show n)) $ map show [0, 2..n-1]
%o A342845 -- Reinhard Zumkeller, Jul 19 2011
%o A342845 (Python)
%o A342845 def a(n):
%o A342845   s, eset = str(n), set()
%o A342845   for i in range(len(s)):
%o A342845     for j in range(i+1, len(s)+1):
%o A342845       if s[j-1] in "02468" and j-i < len(s): # even and proper substring
%o A342845         eset.add(int(s[i:j]))
%o A342845   return len(eset)
%o A342845 print([a(n) for n in range(105)]) # _Michael S. Branicky_, Mar 23 2021
%Y A342845 Cf. A045887, A045888, A342846.
%K A342845 nonn,base,easy
%O A342845 0,21
%A A342845 _Sean A. Irvine_, Mar 24 2021