login
A370371
Largest m such that any two consecutive digits of the base-n expansion of m^2 differ by 1 after arranging the digits in decreasing order.
4
1, 1, 15, 2, 195, 867, 3213, 18858, 99066, 528905, 2950717, 294699, 105011842, 659854601, 4285181505, 1578809181, 198009443151, 1404390324525, 10225782424031, 3635290739033, 583655347579584, 4564790605900107, 36485812146621733, 297764406866494254, 2479167155959358950
OFFSET
2,3
COMMENTS
By definition, a(n) <= sqrt(Sum_{i=0..n-1} i*n^i) = sqrt(A062813(n)). If n is odd and n-1 has an even number of 2s as prime factors, then there are no pandigital squares in base n, so a(n) <= sqrt(Sum_{i=1..n-1} i*n^(i-1)) = sqrt(A051846(n-1)); see A258103.
If n is odd and n-1 has an even 2-adic valuation, then a(n) <= sqrt(Sum_{i=2..n-1} i*n^(i-2)); see A258103. - Chai Wah Wu, Feb 25 2024
LINKS
Michael S. Branicky, Table of n, a(n) for n = 2..28
EXAMPLE
Base 4: 15^2 = 225 = 3201_4;
Base 6: 195^2 = 38025 = 452013_6;
Base 7: 867^2 = 751689 = 6250341_7;
Base 8: 3213^2 = 10323369 = 47302651_8;
Base 9: 18858^2 = 355624164 = 823146570_9;
Base 10: 99066^2 = 9814072356;
Base 11: 528905^2 = 279740499025 = A8701245369_11;
Base 12: 2950717^2 = 8706730814089 = B8750A649321_12;
Base 13: 294699^2 = 86847500601 = 8260975314_13.
PROG
(PARI) isconsecutive(m, n)=my(v=vecsort(digits(m, n))); for(i=2, #v, if(v[i]!=1+v[i-1], return(0))); 1 \\ isconsecutive(k, n) == 1 if and only if any two consecutive digits of the base-n expansion of m differ by 1 after arranging the digits in decreasing order
a(n) = forstep(m=sqrtint(if(n%2==1 && valuation(n-1, 2)%2==0, n^(n-1) - (n^(n-1)-1)/(n-1)^2, n^n - (n^n-n)/(n-1)^2)), 0, -1, if(isconsecutive(m^2, n), return(m)))
(Python)
from math import isqrt
from sympy import multiplicity
from sympy.ntheory import digits
def a(n):
ub = isqrt(sum(i*n**i for i in range(n)))
if n%2 == 1 and multiplicity(2, n-1)%2 == 0:
ub = isqrt(sum(i*n**(i-2) for i in range(2, n)))
return(next(i for i in range(ub, -1, -1) if len(d:=sorted(digits(i*i, n)[1:])) == d[-1]-d[0]+1 == len(set(d))))
print([a(n) for n in range(2, 13)]) # Michael S. Branicky, Feb 23 2024
CROSSREFS
Cf. A215014, A370362, A370370, A258103 (number of pandigital squares in base n).
The actual squares are given by A370611.
Sequence in context: A220376 A040224 A237649 * A040217 A040218 A226379
KEYWORD
nonn,base,hard
AUTHOR
Jianing Song, Feb 16 2024
EXTENSIONS
a(17)-a(20) and a(22)-a(26) from Michael S. Branicky, Feb 23 2024
a(21) from Chai Wah Wu, Feb 25 2024
STATUS
approved