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.

Showing 1-2 of 2 results.

A335051 a(n) is the smallest decimal number > 1 such that when it is written in all bases from base 2 to base n those numbers all contain both 0 and 1.

Original entry on oeis.org

2, 9, 19, 28, 145, 384, 1128, 2601, 2601, 101256, 103824, 382010, 572101, 971400, 1773017, 1773017, 22873201, 64041048, 64041048, 1193875201, 2496140640, 10729882801, 21660922801, 120068616277, 333679563001, 427313653201, 427313653201, 10436523921264, 10868368953601
Offset: 2

Views

Author

Keywords

Comments

The sequence is infinite since 1 + lcm(2,...,n)^2 is always a candidate for a(n). - Giovanni Resta, May 24 2020

Examples

			a(3) = 9 as 9_2 = 1001 and 9_3 = 100, both of which contain a 0 and 1.
a(6) = 145 as 145_2 = 10010001, 145_3 = 12101, 145_4 = 2101, 145_5 = 1040, 145_6 = 401, all of which contain a 0 and 1.
a(9) = 2601 as 2601_2 = 101000101001, 2601_3 = 10120100, 2601_4 = 220221, 2601_5 = 40401, 2602_6 = 20013, 2601_7 = 10404, 2601_8 = 5051, 2601_9 = 3510, all of which contain a 0 and 1. Note that, as 2601 also contains a 0 and 1, a(10) = 2601.
a(16) = 1773017 as 1773017_2 = 110110000110111011001, 1773017_3 = 10100002010022, 1773017_4 = 12300313121, 1773017_5 = 423214032, 1773017_6 = 102000225, 1773017_7 = 21033101, 1773017_8 = 6606731, 1773017_9 = 3302108, 1773017_10 = 1773017, 1773017_11 = 1001104, 1773017_12 = 716075, 1773017_13 = 4A102C, 1773017_14 = 342201, 1773017_15 = 250512, 1773017_16 = 1B0DD9, all of which contain a 0 and 1.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Block[{k=2}, While[ AnyTrue[ Range[n, 2, -1], ! SubsetQ[ IntegerDigits[k, #], {0, 1}] &], k++]; k]; a /@ Range[2, 13] (* Giovanni Resta, May 24 2020 *)
  • Python
    from numba import njit
    @njit
    def hasdigits01(n, b):
        has0, has1 = False, False
        while n >= b:
          n, r = divmod(n, b)
          if r == 0: has0 = True
          if r == 1: has1 = True
          if has0 and has1: return True
        return has0 and (has1 or n==1)
    @njit
    def a(n, start=2):
      k = start
      while True:
        for b in range(n, 1, -1):
          if not hasdigits01(k, b): break
        else: return k
        k += 1
    anm1 = 2
    for n in range(2, 21):
      an = a(n, start=anm1)
      print(an, end=", ")
      anm1 = an # Michael S. Branicky, Feb 09 2021

Extensions

a(29)-a(30) from Giovanni Resta, May 24 2020

A335066 Decimal numbers such that when they are written in all bases from 2 to 10 those numbers all share a common digit (the digit 0 or 1).

Original entry on oeis.org

1, 81, 91, 109, 127, 360, 361, 417, 504, 540, 541, 631, 661, 720, 781, 841, 918, 981, 991, 1008, 1009, 1039, 1080, 1081, 1088, 1089, 1090, 1091, 1093, 1099, 1105, 1111, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1128, 1134, 1135, 1136, 1137, 1138, 1139
Offset: 1

Views

Author

Keywords

Comments

As base 2 is included the only possible common digit between all the bases is either a 0 or 1.

Examples

			1 is a term as 1 written in all bases is 1.
81 is a term as 81_2 = 1010001, 81_3 = 10000, 81_4 = 1101, 81_5 = 311, 81_6 = 213, 81_7 = 144, 81_8 121, 81_9 = 100, 81_10 = 81, all of which contain the digit 1.
360 is a term as 360_2 = 101101000, 360_3 = 111100, 360_4 = 11220, 360_5 = 2420, 360_6 = 1400, 360_7 = 1023, 360_8 = 550, 360_9 = 550, 360_10 = 360, all of which contain the digit 0.
		

Crossrefs

Programs

  • Python
    def hasdigits01(n, b):
        has0, has1 = False, False
        while n >= b:
            n, r = divmod(n, b)
            if r == 0: has0 = True
            if r == 1: has1 = True
            if has0 and has1: return (True, True)
        return (has0, has1 or n==1)
    def ok(n):
        all0, all1 = True, True
        for b in range(10, 1, -1):
            has0, has1 = hasdigits01(n, b)
            all0 &= has0; all1 &= has1
            if not all0 and not all1: return False
        return all0 or all1
    print([k for k in range(1140) if ok(k)]) # Michael S. Branicky, May 23 2022
Showing 1-2 of 2 results.