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.
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
Examples
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.
Links
- Michael S. Branicky, Table of n, a(n) for n = 2..28
Crossrefs
Programs
-
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
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
Comments