OFFSET
1,2
COMMENTS
1, 7 and 32767 also share this property in base 2; their binary expansions consist only of a sequence of 1s.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
EXAMPLE
53 is 1222 in base 3 and 311 in base 4; it only uses the digit 1 or the largest digit in the two bases and is therefore a term.
Similarly 215 is 21222 in base 3 and 3113 in base 4 so it is also a term.
MATHEMATICA
Select[Range@ 1000000, Last@ DigitCount[#, 3] == 0 && Total@ Rest@ Drop[DigitCount[#, 4], {3}] == 0 &] (* Michael De Vlieger, Oct 05 2015 *)
Join[{1, 5}, Flatten[Table[Select[FromDigits[#, 3]&/@Tuples[{1, 2}, n], Union[ IntegerDigits[ #, 4]] =={1, 3}&], {n, 20}]]] (* Harvey P. Dale, Jun 14 2016 *)
PROG
(PARI) is(n)=!setsearch(Set(digits(n, 3)), 0) && #setintersect(Set(digits(n, 4)), [0, 2])==0 \\ Charles R Greathouse IV, Oct 12 2015
(Python)
from gmpy2 import digits
def f1(n):
s = digits(n, 3)
m = len(s)
for i in range(m):
if s[i] == '0':
return(int(s[:i]+'1'*(m-i), 3))
return n
def f2(n):
s = digits(n, 4)
m = len(s)
for i in range(m):
if s[i] == '0':
return(int(s[:i]+'1'*(m-i), 4))
if s[i] == '2':
return(int(s[:i]+'3'+'1'*(m-i-1), 4))
return n
A262958_list = []
n = 1
for i in range(10**4):
m = f2(f1(n))
while m != n:
n, m = m, f2(f1(m))
A262958_list.append(m)
n += 1 # Chai Wah Wu, Oct 30 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robin Powell, Oct 05 2015
STATUS
approved