A030477 Numbers k such that k^2 has property that all even digits occur together and all odd digits occur together.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 17, 18, 20, 21, 22, 24, 25, 28, 29, 30, 32, 34, 38, 40, 42, 44, 45, 47, 49, 51, 53, 56, 58, 60, 62, 65, 67, 68, 72, 76, 78, 79, 80, 83, 86, 88, 91, 92, 93, 98, 100, 102, 108, 118, 120, 122, 124, 132, 134, 138, 140
Offset: 1
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A030476.
Programs
-
Maple
filter:= proc(n) local L,x,m; L:= convert(n^2,base,10) mod 2; if n::odd then if not member(0,L,m) then return true fi; convert(L[m..-1],set) = {0} else if not member(1,L,m) then return true fi; convert(L[m..-1],set) = {1} fi end proc: select(filter, [$0..1000]); # Robert Israel, Oct 27 2024
-
Python
def ok(n): s = "".join("0" if d in "02468" else "1" for d in str(n**2)) return len(set(s.rstrip(s[-1]))) < 2 print([k for k in range(141) if ok(k)]) # Michael S. Branicky, Oct 27 2024
Comments