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.

A382050 a(n) = least positive integer m such that when m*(m+1) is written in base n, it is zeroless and contains every single nonzero digit exactly once, or 0 if no such number exists.

This page as a plain text file.
%I A382050 #16 Mar 17 2025 22:15:44
%S A382050 0,0,5,0,79,0,650,2716,17846,0,277166,1472993,8233003,0,286485314,
%T A382050 1797613432,11675780880,0,538954048563,3821844010905,27824692448867,0,
%U A382050 1587841473665581,12417635018180828,99246128296767625,0,6742930364132819544,57228575814672196977,494789896551823383745,0,38997607084561562847324
%N A382050 a(n) = least positive integer m such that when m*(m+1) is written in base n, it is zeroless and contains every single nonzero digit exactly once, or 0 if no such number exists.
%C A382050 Theorem: if n==3 (mod 4), then a(n) = 0.
%C A382050 Proof:
%C A382050 Since n^a == 1 (mod n-1), k == the digit sum of k in base n (mod n-1). Thus for a zeroless number k with every nonzero digit exactly once, k == n(n-1)/2 (mod n-1).
%C A382050 Suppose n==3 (mod 4), i.e. n=2q+1 for some odd q. Then n(n-1)/2 = 2q^2+q. Since n-1 = 2q, this means that n(n-1)/2 == q (mod n-1). As q is odd, m(m+1)$ is even and n-1 is even, this implies that m(m+1) <> q (mod n-1) and thus m(m+1) is not a zeroless number with every nonzero digit exactly once.
%F A382050 a(n) = 0 if n == 3 (mod 4).
%F A382050 Conjecture: a(n) > 0 if n > 5 and n <> 3 (mod 4).
%e A382050 a(9) = 2716. 2716*2717 = 7379372 which is 14786532 in base 9.
%o A382050 (Python)
%o A382050 from itertools import count
%o A382050 from math import isqrt
%o A382050 from sympy.ntheory import digits
%o A382050 def A382050(n):
%o A382050     k, l, d = (n*(n-1)>>1)%(n-1), n**(n-1)-(n**(n-1)-1)//(n-1)**2, tuple(range(1,n))
%o A382050     clist = [i for i in range(n-1) if i*(i+1)%(n-1)==k]
%o A382050     if len(clist) == 0:
%o A382050         return 0
%o A382050     s = (n**n - n**2 + n - 1)//((n - 1)**2)
%o A382050     s = isqrt((s<<2)+1)-1>>1
%o A382050     s += n-1-s%(n-1)
%o A382050     if s%(n-1) <= max(clist):
%o A382050         s -= n-1
%o A382050     for a in count(s,n-1):
%o A382050         if a*(a+1)>l:
%o A382050             break
%o A382050         for c in clist:
%o A382050             m = a+c
%o A382050             if m*(m+1)>l:
%o A382050                 break
%o A382050             if tuple(sorted(digits(m*(m+1),n)[1:])) == d:
%o A382050                 return m
%o A382050     return 0 # _Chai Wah Wu_, Mar 17 2025
%Y A382050 Cf. A381266.
%K A382050 nonn,base
%O A382050 2,3
%A A382050 _Chai Wah Wu_, Mar 13 2025