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.

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

This page as a plain text file.
%I A342546 #28 May 30 2021 12:59:47
%S A342546 3,7,73,141,1417,17130,11677,187955,10252371,20440221,1550384575,
%T A342546 10645648530,80224807014,829050923579,17071371319785,599574561430568
%N A342546 a(n)^2 is the least square with exactly n 1's in base n.
%e A342546    n     a(n)          a(n)^2    in base n
%e A342546    2        3               9    1001
%e A342546    3        7              49    1211
%e A342546    4       73            5329    1103101
%e A342546    5      141           19881    1114011
%e A342546    6     1417         2007889    111011441
%e A342546    7    17130       293436900    10162113111
%e A342546    8    11677       136352329    1010111111
%e A342546    9   187955     35327082025    111160121111
%e A342546   10 10252371 105111111121641    105111111121641
%o A342546 (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)))
%o A342546 (Python)
%o A342546 from sympy import integer_nthroot
%o A342546 from numba import njit
%o A342546 @njit # works with 64 bits through a(12)
%o A342546 def digits1(n, b):
%o A342546   count1 = 0
%o A342546   while n >= b:
%o A342546     n, r = divmod(n, b)
%o A342546     count1 += (r==1)
%o A342546   return count1 + (n==1)
%o A342546 def a(n):
%o A342546   an = integer_nthroot(n**(n-1), 2)[0] + 1
%o A342546   while digits1(an*an, n) != n: an += 1
%o A342546   return an
%o A342546 print([a(n) for n in range(2, 10)]) # _Michael S. Branicky_, Apr 07 2021
%Y A342546 Cf. A000290, A342260, A342545.
%K A342546 nonn,base,more
%O A342546 2,1
%A A342546 _Hugo Pfoertner_, Apr 07 2021
%E A342546 a(14) from _Chai Wah Wu_, Apr 14 2021
%E A342546 a(15)-a(16) from _Giovanni Resta_, Apr 17 2021
%E A342546 a(17) from _Martin Ehrenstein_, May 29 2021