login
Numbers k for which there are A000005(k+1)-1 bases b such that k in base b contains digit b-1.
1

%I #25 Mar 07 2021 18:54:02

%S 1,3,5,9,11,17,27,35,37,39,41,65,81,83,85,89,131,149,179,203,255,257,

%T 263,407,419,455,539,739,811,899,1031,1109,1385,1619,1631,1883,2819,

%U 3299,3527,4133,4139,4151,4919,5669,5939,6299,7055,7307,8303,9829,9839,10661

%N Numbers k for which there are A000005(k+1)-1 bases b such that k in base b contains digit b-1.

%C If k written in some base b has b-1 as its least significant digit, then b is a divisor of k+1 (because k = high*b + b-1 means k+1 = b*(high+1)). The present sequence is those k where such divisors are in fact the only bases b where digit b-1 occurs.

%C In terms of the count of bases in A337496, the divisors give a lower bound A337496(k) >= tau(k+1)-1 (number of divisors except 1). The present sequence is those k at this lower bound.

%C There are 147 terms to k <= 10^8.

%H Kevin Ryde, <a href="/A340287/a340287.c.txt">C code searching for terms</a>

%e 1 is a term because A000005(1+1)-1 = 1 such that 1 in base 2 (2|2) contains digit 1 and there are no such bases of 1 which are non-divisors of 1+1.

%e 5 is a term because A000005(5+1)-1 = 3 such that 5 in base 2,3,6 (2|6,3|6 and 6|6) contains digit 1,2,5 respectively and there are no such bases of 5 which are non-divisors of 5+1.

%t baseQ[n_, b_] := MemberQ[IntegerDigits[n, b], b - 1]; q[n_] := Count[Range[2, n + 1], _?(baseQ[n, #] &)] == DivisorSigma[0, n + 1] - 1; Select[Range[1000], q] (* _Amiram Eldar_, Jan 03 2021 *)

%o (Python)

%o def is_n_with_no_nondivisor_baseb(N):

%o return list(filter(n_with_no_nondivisor_baseb,range(1,N+1,2)))

%o def n_with_no_nondivisor_baseb(n):

%o main_base_counter=0

%o for b in range(3,((n+1)//2) +1):

%o if (n+1)%b!=0:

%o main_base_counter=main_base_check(n//b,b)+main_base_counter

%o if main_base_counter==1:

%o break

%o return main_base_counter==0

%o def main_base_check(m,b):

%o while m!=0:

%o if m%b == b-1:

%o return 1

%o m = m//b

%o if m==0:

%o return 0

%o print(is_n_with_no_nondivisor_baseb(int(input())))

%o (PARI) isok(k) = sum(b=2, k+1, (#select(x->(x==(b-1)), digits(k, b)))>0) == numdiv(k+1)-1; \\ _Michel Marcus_, Jan 03 2021

%Y Cf. A000005, A337496.

%K nonn,base

%O 1,2

%A _Devansh Singh_, Jan 03 2021