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.
%I A382054 #19 Mar 17 2025 22:15:38 %S A382054 0,0,14,54,0,616,2251,12069,0,251085,1348305,7619403,0,269717049, %T A382054 1698727527,11061795398,0,513383208454,3648738866370,26618719297968,0, %U A382054 1524495582671125,11941193897016731,95578593301936475,0,6510865478836888683,55324396705324796861,478855818873249715068,0,37817609915967014967822 %N A382054 a(n) = least positive integer m such that when m*(m+1) is written in base n, it does not contain the digit n-1 and contains every single digit from 0 to n-2 exactly once, or 0 if no such number exists. %C A382054 Theorem: %C A382054 a(n) = 0 if n == 3 (mod 4). %C A382054 Proof: %C A382054 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 from 0 to n-2 exactly once, k == (n-2)(n-1)/2 == n(n-1)/2 (mod n-1). %C A382054 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 from 0 to n-2 exactly once and the proof is complete. %C A382054 Conjecture: a(n) > 0 if n > 4 and n <> 3 (mod 4). %F A382054 a(n) = 0 if n == 3 (mod 4). %e A382054 a(9) = 2251 since 2251*2252 = 5069252 which is 10475632 in base 9. %o A382054 (Python) %o A382054 from itertools import count %o A382054 from math import isqrt %o A382054 from sympy.ntheory import digits %o A382054 def A382054(n): %o A382054 k, l, d= (n*(n-1)>>1)%(n-1), (n - n**n + (n - 1)**2*(n**n + n**(n - 1)*(1 - n)))//(n - 1)**2, tuple(range(n-1)) %o A382054 clist = [i for i in range(n-1) if i*(i+1)%(n-1)==k] %o A382054 if len(clist) == 0: %o A382054 return 0 %o A382054 s = (n**(n - 1) + (n - 1)**2*(n**(n - 3)*(n - 1) - 1) - 1)//(n - 1)**2 %o A382054 s = isqrt((s<<2)+1)-1>>1 %o A382054 s += n-1-s%(n-1) %o A382054 if s%(n-1) <= max(clist): %o A382054 s -= n-1 %o A382054 for a in count(s,n-1): %o A382054 if a*(a+1)>l: %o A382054 break %o A382054 for c in clist: %o A382054 m = a+c %o A382054 if m*(m+1)>l: %o A382054 break %o A382054 if tuple(sorted(digits(m*(m+1),n)[1:]))==d: %o A382054 return m %o A382054 return 0 # _Chai Wah Wu_, Mar 17 2025 %Y A382054 Cf. A381266, A382050, A382054. %K A382054 nonn,base %O A382054 3,3 %A A382054 _Chai Wah Wu_, Mar 13 2025