login
A030478
Numbers k such that k^3 has property that all even digits occur together and all odd digits occur together.
2
0, 1, 2, 3, 4, 8, 10, 11, 12, 13, 15, 17, 19, 20, 22, 24, 26, 31, 33, 34, 35, 39, 40, 42, 46, 52, 54, 58, 59, 71, 72, 80, 82, 91, 92, 93, 95, 100, 104, 110, 120, 124, 131, 135, 137, 150, 152, 169, 172, 173, 174, 175, 179, 200, 202, 211, 220, 240, 258, 259
OFFSET
1,3
COMMENTS
From Robert Israel, Oct 27 2024: (Start)
If x is an even member, then so is 10 * x.
2^k + 2 is a member for every k.
(End)
LINKS
David A. Corneth, Table of n, a(n) for n = 1..4505 (first 2500 terms from Robert Israel, terms <= 10^10)
David A. Corneth, PARI program
EXAMPLE
From David A. Corneth, Oct 28 2024: (Start)
12 is in the sequence as 12^3 = 1728 has all even digits occur together and all odd digits occur together. That we can place a bar somewhere between the digits of 1728 so that all odd digits are on one side of the bar and all even digits are on the other side of the bar. In this case that would be 17|28 where all odd digits are on the left of the bar and all even digits are on the other side of the bar.
16 is not in the sequence. To split the even from odd digits in 16^3 = 4096 we would need more than 1 bar, like so: 40|9|6.
321 is not in the sequence as for 321^3 = 33076161 we would need more than two bars to split even from odd. Like so: 33|0|7|6|1|6|1. As the last three digits must be split by more than one bar and 321 has at least three digits no term can end in the last three digits of 321 which means no term can end in 321. Using this idea we can ease the search significantly. (End)
MAPLE
filter:= proc(n) local L, x, m;
L:= convert(n^3, 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
MATHEMATICA
Select[Range[0, 300], Length[Split[If[OddQ[#], 1, 0]&/@IntegerDigits[ #^3]]]<3&] (* Harvey P. Dale, Mar 27 2016 *)
PROG
(Python)
def ok(n):
s = "".join("0" if d in "02468" else "1" for d in str(n**3))
return len(set(s.rstrip(s[-1]))) < 2
print([k for k in range(260) if ok(k)]) # Michael S. Branicky, Oct 28 2024
(PARI) \\ See Corneth link
CROSSREFS
Sequence in context: A175404 A292113 A082224 * A118252 A047456 A279000
KEYWORD
nonn,base
STATUS
approved