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.

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

This page as a plain text file.
%I A381266 #27 Mar 17 2025 22:15:51
%S A381266 1,0,12,34,134,0,1477,6891,38627,0,891230,4874690,28507439,0,
%T A381266 1078575795,7002987575,46916000817,0,2295911609450,16720559375850,
%U A381266 124852897365573,0,7468470450367652,59705969514613035,487357094495846175,0,34452261762372201726,297930994005481958694
%N A381266 a(n) = least positive integer m such that when m*(m+1) is written in base n, it contains every single digit exactly once, or 0 if no such number exists.
%C A381266 It appears that for each base of the form 4k+3, no number can be found that satisfies the requirement.
%C A381266 From _Chai Wah Wu_, Mar 13 2025: (Start)
%C A381266 The above observation is true.
%C A381266 Theorem: if n==3 (mod 4), then a(n) = 0.
%C A381266 Proof: Since n^a == 1 (mod n-1), k == the digit sum of k in base n (mod n-1). Thus for a number k with every digit exactly once, k == n(n-1)/2 (mod n-1).
%C A381266 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 number with every digit exactly once and the proof is complete.
%C A381266 Conjecture: a(n) = 0 if and only if n==3 (mod 4).
%C A381266 (End)
%H A381266 Daniel Mondot, <a href="/A381266/a381266.txt">details for each term, in respective base.</a>
%F A381266 a(n) = 0 if n == 3 (mod 4). - _Chai Wah Wu_, Mar 13 2025
%e A381266 1477 is 2705 in octal. 2705 * 2706 = 10247536 (base 8)
%e A381266 38627 * 38628 = 1492083756 (base 10)
%e A381266 see a381266.txt for more
%o A381266 (Python)
%o A381266 from itertools import count
%o A381266 from math import isqrt
%o A381266 from sympy.ntheory import digits
%o A381266 def A381266(n):
%o A381266     k, l, d = (n*(n-1)>>1)%(n-1), n**n-(n**n-n)//(n-1)**2, tuple(range(n))
%o A381266     clist = [i for i in range(n-1) if i*(i+1)%(n-1)==k]
%o A381266     if len(clist) == 0:
%o A381266         return 0
%o A381266     s = (n**n-n)//(n-1)**2+n**(n-2)*(n-1)-1
%o A381266     s = isqrt((s<<2)+1)-1>>1
%o A381266     s += n-1-s%(n-1)
%o A381266     if s%(n-1) <= max(clist):
%o A381266         s -= n-1
%o A381266     for a in count(s,n-1):
%o A381266         if a*(a+1)>l:
%o A381266             break
%o A381266         for c in clist:
%o A381266             m = a+c
%o A381266             if m*(m+1)>l:
%o A381266                 break
%o A381266             if tuple(sorted(digits(m*(m+1),n)[1:]))==d:
%o A381266                 return m
%o A381266     return 0 # _Chai Wah Wu_, Mar 17 2025
%Y A381266 Cf. A381248.
%K A381266 nonn,base
%O A381266 2,3
%A A381266 _Daniel Mondot_ and _Ali Sada_, Feb 18 2025
%E A381266 a(19)-a(29) from _Chai Wah Wu_, Mar 12 2025