login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A342845 Number of distinct even numbers visible as proper substrings of n. 4
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,21
COMMENTS
Here substrings must be contiguous.
LINKS
Sean A. Irvine, Java program (github)
EXAMPLE
a(10)=1 because we can form 0.
a(24)=2 because we can form 2, 4.
a(102)=3 because we can form 0, 2, 10.
a(124)=4 because we can form the following even numbers: 2, 4, 12, 24.
PROG
(Haskell)
import Data.List (isInfixOf)
a045887 n = length $ filter (`isInfixOf` (show n)) $ map show [0, 2..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 "02468" and j-i < len(s): # even and proper substring
eset.add(int(s[i:j]))
return len(eset)
print([a(n) for n in range(105)]) # Michael S. Branicky, Mar 23 2021
CROSSREFS
Sequence in context: A276172 A322028 A079806 * A045887 A056832 A105931
KEYWORD
nonn,base,easy
AUTHOR
Sean A. Irvine, Mar 24 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 11:39 EDT 2024. Contains 371969 sequences. (Running on oeis4.)