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.

A342846 Number of distinct odd numbers visible as proper substrings of n.

This page as a plain text file.
%I A342846 #10 Mar 26 2021 06:32:57
%S A342846 0,0,0,0,0,0,0,0,0,1,1,1,2,1,2,1,2,1,2,0,1,0,1,0,1,0,1,0,1,1,2,1,1,1,
%T A342846 2,1,2,1,2,0,1,0,1,0,1,0,1,0,1,1,2,1,2,1,1,1,2,1,2,0,1,0,1,0,1,0,1,0,
%U A342846 1,1,2,1,2,1,2,1,1,1,2,0,1,0,1,0,1,0,1,0,1,1,2,1,2,1,2,1,2,1,1,1,1,1,2,1,2
%N A342846 Number of distinct odd numbers visible as proper substrings of n.
%C A342846 Here substrings are contiguous.
%C A342846 a(A164766(n)) = n and a(m) <> n for m < A164766(n); a(A014263(n)) = 0. - _Reinhard Zumkeller_, Aug 25 2009
%H A342846 Reinhard Zumkeller, <a href="/A342846/b342846.txt">Table of n, a(n) for n = 1..20000</a>
%H A342846 Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a342/A342846.java">Java program</a> (github)
%e A342846 a(10)=1 since we can see 1 as a proper substring of 10.
%e A342846 a(105)=2 since we can see 1, 5.
%e A342846 a(132)=3 because we can see 1, 3, 13.
%o A342846 (Haskell)
%o A342846 import Data.List (isInfixOf)
%o A342846 a045888 n = length $ filter (`isInfixOf` (show n)) $ map show [1, 3..n-1]
%o A342846 -- Reinhard Zumkeller, Jul 19 2011
%o A342846 (Python)
%o A342846 def a(n):
%o A342846   s, eset = str(n), set()
%o A342846   for i in range(len(s)):
%o A342846     for j in range(i+1, len(s)+1):
%o A342846       if s[j-1] in "13579" and j-i < len(s): # odd and proper substring
%o A342846         eset.add(int(s[i:j]))
%o A342846   return len(eset)
%o A342846 print([a(n) for n in range(1, 105)]) # _Michael S. Branicky_, Mar 24 2021
%Y A342846 Cf. A045887, A045888, A342845.
%K A342846 nonn,base,easy
%O A342846 1,13
%A A342846 _Sean A. Irvine_, Mar 24 2021