login
A275600
Numbers that can be written in all bases from base 2 to base 6 using only the digits 0, 1 and 2.
6
0, 1, 2, 6, 36, 37, 260, 1302, 1376, 1380, 1381, 1382, 1556, 1560, 1561, 1562, 16932, 562500, 562501, 562502, 562506, 562512, 562536, 562537, 562752, 562760, 23610752, 23610756, 23610757, 23610786, 23615750, 23615760, 23615761, 23615762, 23615785, 23615786, 23626310
OFFSET
1,3
COMMENTS
Is there any number that keeps this property also in base 7, other than the trivial cases 0,1,2?
LINKS
Rémy Sigrist and Chai Wah Wu, Table of n, a(n) for n = 1..10000 [Terms 1 through 187 by Chai Wah Wu]
EXAMPLE
16932 is in the sequence because this number can be written in bases 2 through 6 using only the digits 0, 1 and 2: 16932(b4) = 10020210 / (b5) = 1020212 / (b6) = 210220.
MATHEMATICA
Select[Range[10^6], Function[k, Max@ Flatten@ Map[IntegerDigits[k, #] &, Range[4, 6]] < 3]] (* or *)
Select[Range[10^5], Function[k, Total@ Flatten@ Map[Take[RotateRight@ DigitCount[k, #], -(# - 3)] &, Range[4, 6]] == 0]] (* (not as efficient) Michael De Vlieger, Aug 03 2016 *)
PROG
(Python) from gmpy2 import digits
A275600_list = [n for n in (int(digits(m, 3), 6) for m in range(10**6)) if max(digits(n, 5)) <= '2' and max(digits(n, 4)) <= '2'] # Chai Wah Wu, Aug 15 2016
(Perl) use ntheory ":all"; my($x, $n10)=(0, 0); while ($x < 50) { my $n = fromdigits( todigitstring($n10++, 3), 6); next if vecany { $_ > 2 } todigits($n, 4); next if vecany { $_ > 2 } todigits($n, 5); print ++$x, " $n\n"; } # Dana Jacobsen, Aug 16 2016
(PARI) nextWithSmallDigits(n, base) = my (pow=1, rem=n, val=0, d); while (rem>0, d = rem % base; rem = rem \ base; if (d>2, val = 0; rem = rem+1, val = val + d*pow); pow = pow * base); return (val)
{ n = 0; prev = 0; while (n < 300, succ = prev; for (b=4, 6, succ = nextWithSmallDigits(succ, b)); if (prev==succ, n = n+1; print(n " " prev); prev = succ+1, prev = succ)) } \\ Rémy Sigrist, Sep 08 2016
KEYWORD
nonn,base
AUTHOR
Sergio Pimentel, Aug 03 2016
EXTENSIONS
a(18)-a(26) from Michael De Vlieger, Aug 03 2016
a(27)-a(37) from Chai Wah Wu, Aug 15 2016
STATUS
approved