login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A291592 Number of bases for which 2^n-1 is a repdigit with at least 3 digits. 1
0, 0, 1, 1, 2, 2, 1, 2, 2, 2, 1, 4, 2, 2, 3, 3, 1, 4, 1, 4, 3, 2, 1, 6, 2, 2, 3, 4, 1, 6, 1, 4, 3, 2, 3, 7, 1, 2, 3, 6, 1, 6, 1, 4, 5, 2, 1, 8, 2, 4, 3, 4, 1, 6, 3, 6, 3, 2, 1, 10, 1, 2, 5, 5, 3, 6, 1, 4, 3, 6, 1, 10 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,5
LINKS
EXAMPLE
For n=3, 2^3-1 is 7; 7 is a repdigit with more than 3 digits only in base 2: 111_2. So a(3)=1.
For n=5, 2^5-1 is 31; 31 is a repdigit with more than 3 digits only in base 2 and 5: 11111_2 and 111_5 So a(5)=2.
MATHEMATICA
Table[With[{m = 2^n - 1}, Count[Range[2, Floor@ Sqrt@ m], _?(And[Length@ Union@ # == 1, Length@ # >= 3] &@ IntegerDigits[m, #] &) ]], {n, 40}] (* Michael De Vlieger, Aug 27 2017 *)
PROG
(PARI) nbr(n) = {nb = 0; fordiv(n, d, for (b=d+1, n, nd = 3; vd = [d, d, d]; while(fromdigits(vd, b) < n, nd ++; vd = vector(nd, k, d)); if ((x=fromdigits(vd, b)) == n, nb++); if ((x > n) && (nd == 3), break); ); ); nb; }
a(n) = nbr(2^n-1);
(Python)
from sympy.ntheory import count_digits
def ok(n, b): return False if n <= b**2 else len(count_digits(n, b)) == 1
def a(n): return sum(ok(2**n-1, b) for b in range(2, 2**n))
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, May 27 2021
(Python) # Faster version suitable for extension
def is_repdigit(n, b):
if n < b: return True
n, r = divmod(n, b)
onlyd = r
while n > b:
n, r = divmod(n, b)
if r != onlyd: return False
return n == onlyd
def a(n):
c, target = 0, 2**n - 1
for b in range(2, 2**n):
if target < b**2: break # not 3 digits
c += is_repdigit(target, b)
return c
print([a(n) for n in range(1, 41)]) # Michael S. Branicky, May 27 2021
CROSSREFS
Sequence in context: A279346 A168258 A116204 * A159905 A283735 A274534
KEYWORD
nonn,more
AUTHOR
Michel Marcus, Aug 27 2017
EXTENSIONS
a(63)-a(72) from Michael S. Branicky, May 28 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 18:16 EDT 2024. Contains 371916 sequences. (Running on oeis4.)