login
A370611
Largest square such that any two consecutive digits of its base-n expansion differ by 1 after arranging the digits in decreasing order.
2
1, 1, 225, 4, 38025, 751689, 10323369, 355624164, 9814072356, 279740499025, 8706730814089, 86847500601, 11027486960232964, 435408094460869201, 18362780530794065025, 2492638430009890761, 39207739576969100808801, 1972312183619434816475625, 104566626183621314286288961, 13215338757299095309775089
OFFSET
2,3
COMMENTS
By definition, a(n) <= Sum_{i=0..n-1} i*n^i = 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) <= Sum_{i=1..n-1} i*n^(i-1) = A051846(n-1); see A258103.
If n is odd and n-1 has an even 2-adic valuation, then a(n) <= Sum_{i=2..n-1} i*n^(i-2); see A258103. - Chai Wah Wu, Feb 25 2024
EXAMPLE
See the Example section of A370371.
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^2)))
CROSSREFS
Cf. A215014, A370370, A370610, A258103 (number of pandigital squares in base n).
The square roots are given by A370371.
Sequence in context: A204704 A206649 A340501 * A265432 A247885 A345552
KEYWORD
nonn,base,hard
AUTHOR
Jianing Song, Feb 23 2024
EXTENSIONS
a(17)-a(20) from Michael S. Branicky, Feb 23 2024
a(21) from Chai Wah Wu, Feb 25 2024
STATUS
approved