login
A338420
Numbers k having exactly one base b which is not a divisor of k+1, and k contains the digit b-1 in base b.
1
2, 4, 7, 8, 10, 13, 15, 19, 23, 25, 26, 29, 31, 36, 38, 40, 51, 53, 55, 59, 63, 71, 80, 82, 84, 86, 87, 99, 101, 107, 109, 119, 127, 128, 129, 137, 143, 151, 152, 155, 161, 167, 169, 209, 215, 227, 256, 259, 260, 261, 265, 266, 267, 269, 271
OFFSET
1,1
COMMENTS
All the terms of A337536 are in this sequence except A337536(2)=3.
There are only 30 terms which are even up to n=124705.
MATHEMATICA
baseCount[n_] := Count[Complement[Range[n + 1], Divisors[n + 1]], _?(MemberQ[ IntegerDigits[n, #], # - 1] &)]; Select[Range[1000], baseCount[#] == 1 &] (* Amiram Eldar, Oct 25 2020 *)
PROG
(Python)
def A338420(N):
return list(filter(isA338420, range(1, N+1)))
def isA338420(n):
counter=0
if n==2 or n==4:
return True
if n%2==0:
counter=1
for b in range(3, (n//2) +1):
if (n+1)%b!=0:
counter=main_base_check(int(n/b), b)+counter
return counter==1
def main_base_check(m, b):
while m!=0:
if m%b == b-1:
return 1
m = m//b
return 0
print(A338420(int(input())))
(PARI) isok(k) = sum(b=2, k+1, ((k+1) % b) && #select(x->(x==b-1), digits(k, b))) == 1; \\ Michel Marcus, Oct 30 2020
CROSSREFS
Cf. A337536.
Sequence in context: A371638 A039581 A367498 * A182218 A093701 A045601
KEYWORD
nonn,base
AUTHOR
Devansh Singh, Oct 25 2020
STATUS
approved