login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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

%I #10 Mar 26 2021 06:32:57

%S 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 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 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 Number of distinct odd numbers visible as proper substrings of n.

%C Here substrings are contiguous.

%C a(A164766(n)) = n and a(m) <> n for m < A164766(n); a(A014263(n)) = 0. - _Reinhard Zumkeller_, Aug 25 2009

%H Reinhard Zumkeller, <a href="/A342846/b342846.txt">Table of n, a(n) for n = 1..20000</a>

%H Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a342/A342846.java">Java program</a> (github)

%e a(10)=1 since we can see 1 as a proper substring of 10.

%e a(105)=2 since we can see 1, 5.

%e a(132)=3 because we can see 1, 3, 13.

%o (Haskell)

%o import Data.List (isInfixOf)

%o a045888 n = length $ filter (`isInfixOf` (show n)) $ map show [1, 3..n-1]

%o -- Reinhard Zumkeller, Jul 19 2011

%o (Python)

%o def a(n):

%o s, eset = str(n), set()

%o for i in range(len(s)):

%o for j in range(i+1, len(s)+1):

%o if s[j-1] in "13579" and j-i < len(s): # odd and proper substring

%o eset.add(int(s[i:j]))

%o return len(eset)

%o print([a(n) for n in range(1, 105)]) # _Michael S. Branicky_, Mar 24 2021

%Y Cf. A045887, A045888, A342845.

%K nonn,base,easy

%O 1,13

%A _Sean A. Irvine_, Mar 24 2021