A333369 Positive integers in which any odd digit, if present, occurs an odd number of times, and any even digit, if present, occurs an even number of times.
1, 3, 5, 7, 9, 13, 15, 17, 19, 22, 31, 35, 37, 39, 44, 51, 53, 57, 59, 66, 71, 73, 75, 79, 88, 91, 93, 95, 97, 100, 111, 122, 135, 137, 139, 144, 153, 157, 159, 166, 173, 175, 179, 188, 193, 195, 197, 212, 221, 223, 225, 227, 229, 232, 252, 272, 292, 300, 315, 317, 319, 322
Offset: 1
Examples
656 is a 3-digit term because it has one 5 and two 6's. 447977 is a 6-digit term because it has one 9, two 4's and three 7's.
Links
- Michel Marcus, Table of n, a(n) for n = 1..10000
- Project Euler, Problem 520: Simbers.
Programs
-
Mathematica
seqQ[n_] := AllTrue[Tally @ IntegerDigits[n], EvenQ[Plus @@ #] &]; Select[Range[300], seqQ] (* Amiram Eldar, Mar 17 2020 *)
-
PARI
isok(m) = my(d=digits(m), s=Set(d)); for (i=1, #s, if (#select(x->(x==s[i]), d) % 2 != (s[i] % 2), return (0))); return (1); \\ Michel Marcus, Mar 17 2020
-
Python
def ok(n): s = str(n); return all(s.count(d)%2 == int(d)%2 for d in set(s)) print([k for k in range(323) if ok(k)]) # Michael S. Branicky, Apr 15 2022
Comments