This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A340287 #25 Mar 07 2021 18:54:02 %S A340287 1,3,5,9,11,17,27,35,37,39,41,65,81,83,85,89,131,149,179,203,255,257, %T A340287 263,407,419,455,539,739,811,899,1031,1109,1385,1619,1631,1883,2819, %U A340287 3299,3527,4133,4139,4151,4919,5669,5939,6299,7055,7307,8303,9829,9839,10661 %N A340287 Numbers k for which there are A000005(k+1)-1 bases b such that k in base b contains digit b-1. %C A340287 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 A340287 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 A340287 There are 147 terms to k <= 10^8. %H A340287 Kevin Ryde, <a href="/A340287/a340287.c.txt">C code searching for terms</a> %e A340287 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 A340287 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 A340287 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 A340287 (Python) %o A340287 def is_n_with_no_nondivisor_baseb(N): %o A340287 return list(filter(n_with_no_nondivisor_baseb,range(1,N+1,2))) %o A340287 def n_with_no_nondivisor_baseb(n): %o A340287 main_base_counter=0 %o A340287 for b in range(3,((n+1)//2) +1): %o A340287 if (n+1)%b!=0: %o A340287 main_base_counter=main_base_check(n//b,b)+main_base_counter %o A340287 if main_base_counter==1: %o A340287 break %o A340287 return main_base_counter==0 %o A340287 def main_base_check(m,b): %o A340287 while m!=0: %o A340287 if m%b == b-1: %o A340287 return 1 %o A340287 m = m//b %o A340287 if m==0: %o A340287 return 0 %o A340287 print(is_n_with_no_nondivisor_baseb(int(input()))) %o A340287 (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 A340287 Cf. A000005, A337496. %K A340287 nonn,base %O A340287 1,2 %A A340287 _Devansh Singh_, Jan 03 2021