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.

A342545 a(n)^2 is the least square that has exactly n 0's in base n.

Original entry on oeis.org

2, 24, 16, 280, 216, 3430, 4096, 19683, 100000, 4348377, 2985984, 154457888, 105413504, 4442343750, 4294967296, 313909084845, 198359290368, 8712567840033, 10240000000000, 500396429346030, 584318301411328, 38112390316557080, 36520347436056576, 298023223876953125
Offset: 2

Views

Author

Hugo Pfoertner, Apr 07 2021

Keywords

Examples

			   n    a(n)         a(n)^2   in base n
   2       2              4   100
   3      24            576   210100
   4      16            256   10000
   5     280          78400   10002100
   6     216          46656   1000000
   7    3430       11764900   202000000
   8    4096       16777216   100000000
   9   19683      387420489   1000000000
  10  100000    10000000000   10000000000
  11 4348377 18908382534129   6030000000000
  12 2985984  8916100448256   1000000000000
		

Crossrefs

Programs

  • PARI
    for(b=2,12,for(k=1,oo,my(s=k^2,v=digits(s,b));if(sum(k=1,#v,v[k]==0)==b,print1(k,", ");break)))
    
  • Python
    from numba import njit
    @njit # works with 64 bits through a(14)
    def digits0(n, b):
      count0 = 0
      while n >= b:
        n, r = divmod(n, b)
        count0 += (r==0)
      return count0 + (n==0)
    from sympy import integer_nthroot
    def a(n):
      an = integer_nthroot(n**n, 2)[0]
      while digits0(an*an, n) != n: an += 1
      return an
    print([a(n) for n in range(2, 13)]) # Michael S. Branicky, Apr 07 2021
    
  • Python
    from itertools import product
    from functools import reduce
    from sympy.utilities.iterables import multiset_permutations
    from sympy import integer_nthroot
    def A342545(n):
        for a in range(1,n):
            p, q = integer_nthroot(a*n**n,2)
            if q: return p
        l = 1
        while True:
            cmax = n**(l+n+1)
            for a in range(1,n):
                c = cmax
                for b in product(range(1,n),repeat=l):
                    for d in multiset_permutations((0,)*n+b):
                        p, q = integer_nthroot(reduce(lambda c, y: c*n+y, [a]+d),2)
                        if q: c = min(c,p)
                if c < cmax:
                    return c
            l += 1 # Chai Wah Wu, Apr 07 2021

Formula

a(2*n) = A062971(n) = 2*A193678(n).

Extensions

More terms from Chai Wah Wu, Apr 07 2021

A342546 a(n)^2 is the least square with exactly n 1's in base n.

Original entry on oeis.org

3, 7, 73, 141, 1417, 17130, 11677, 187955, 10252371, 20440221, 1550384575, 10645648530, 80224807014, 829050923579, 17071371319785, 599574561430568
Offset: 2

Views

Author

Hugo Pfoertner, Apr 07 2021

Keywords

Examples

			   n     a(n)          a(n)^2    in base n
   2        3               9    1001
   3        7              49    1211
   4       73            5329    1103101
   5      141           19881    1114011
   6     1417         2007889    111011441
   7    17130       293436900    10162113111
   8    11677       136352329    1010111111
   9   187955     35327082025    111160121111
  10 10252371 105111111121641    105111111121641
		

Crossrefs

Programs

  • PARI
    for(b=2,10,for(k=1,oo,my(s=k^2,d=digits(s,b));if(sum(k=1,#d,d[k]==1)==b,print1(k,", ");break)))
    
  • Python
    from sympy import integer_nthroot
    from numba import njit
    @njit # works with 64 bits through a(12)
    def digits1(n, b):
      count1 = 0
      while n >= b:
        n, r = divmod(n, b)
        count1 += (r==1)
      return count1 + (n==1)
    def a(n):
      an = integer_nthroot(n**(n-1), 2)[0] + 1
      while digits1(an*an, n) != n: an += 1
      return an
    print([a(n) for n in range(2, 10)]) # Michael S. Branicky, Apr 07 2021

Extensions

a(14) from Chai Wah Wu, Apr 14 2021
a(15)-a(16) from Giovanni Resta, Apr 17 2021
a(17) from Martin Ehrenstein, May 29 2021
Showing 1-2 of 2 results.