cp's OEIS Frontend

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.

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

Original entry on oeis.org

1, 3, 5, 9, 11, 17, 27, 35, 37, 39, 41, 65, 81, 83, 85, 89, 131, 149, 179, 203, 255, 257, 263, 407, 419, 455, 539, 739, 811, 899, 1031, 1109, 1385, 1619, 1631, 1883, 2819, 3299, 3527, 4133, 4139, 4151, 4919, 5669, 5939, 6299, 7055, 7307, 8303, 9829, 9839, 10661
Offset: 1

Views

Author

Devansh Singh, Jan 03 2021

Keywords

Comments

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.
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.
There are 147 terms to k <= 10^8.

Examples

			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.
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.
		

Crossrefs

Programs

  • Mathematica
    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 *)
  • 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
  • Python
    def is_n_with_no_nondivisor_baseb(N):
        return list(filter(n_with_no_nondivisor_baseb,range(1,N+1,2)))
    def n_with_no_nondivisor_baseb(n):
        main_base_counter=0
        for b in range(3,((n+1)//2) +1):
            if (n+1)%b!=0:
                main_base_counter=main_base_check(n//b,b)+main_base_counter
                if main_base_counter==1:
                    break
        return main_base_counter==0
    def main_base_check(m,b):
        while m!=0:
            if m%b == b-1:
                return 1
            m = m//b
        if m==0:
            return 0
    print(is_n_with_no_nondivisor_baseb(int(input())))