A342846 Number of distinct odd numbers visible as proper substrings of n.
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, 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, 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
Offset: 1
Examples
a(10)=1 since we can see 1 as a proper substring of 10. a(105)=2 since we can see 1, 5. a(132)=3 because we can see 1, 3, 13.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..20000
- Sean A. Irvine, Java program (github)
Programs
-
Haskell
import Data.List (isInfixOf) a045888 n = length $ filter (`isInfixOf` (show n)) $ map show [1, 3..n-1] -- Reinhard Zumkeller, Jul 19 2011
-
Python
def a(n): s, eset = str(n), set() for i in range(len(s)): for j in range(i+1, len(s)+1): if s[j-1] in "13579" and j-i < len(s): # odd and proper substring eset.add(int(s[i:j])) return len(eset) print([a(n) for n in range(1, 105)]) # Michael S. Branicky, Mar 24 2021
Comments