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.

A370370 Number of squares such that any two consecutive digits of their base-n expansions differ by 1 after arranging the digits in decreasing order.

This page as a plain text file.
%I A370370 #19 Feb 24 2024 11:08:09
%S A370370 2,2,6,3,10,12,14,48,160,148,226,54,1277,2675,6812,2525
%N A370370 Number of squares such that any two consecutive digits of their base-n expansions differ by 1 after arranging the digits in decreasing order.
%e A370370 a(4) = 6 because there are 6 such squares in base 4: 0^2 = 0 = 0_4, 1^2 = 1 = 1_4, 2^2 = 4 = 10_4, 3^2 = 9 = 21_4, 6^2 = 36 = 210_4 and 15^2 = 225 = 3201_4.
%e A370370 a(6) = 10 because there are 10 such squares in base 6: 0^2 = 0 = 0_6, 1^2 = 1 = 1_6, 2^2 = 4 = 2_6, 9^2 = 81 = 213_6, 11^2 = 121 = 321_6, 21^2 = 441 = 2013_6, 50^2 = 2500 = 15324_6, 75^2 = 5625 = 42013_6, 85^2 = 7225 = 53241_6 and 195^2 = 38025 = 452013_6.
%e A370370 a(10) = 160 because there are 160 terms in A370362 (or A370610).
%o A370370 (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
%o A370370 a(n) = my(lim=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)), count=0); for(m=0, lim, if(isconsecutive(m^2,n), count++)); count \\ See A258103 for the searching limit of m
%o A370370 (Python) # replace n**n with ub in A370371 for faster version
%o A370370 from math import isqrt
%o A370370 from sympy.ntheory import digits
%o A370370 def a(n): return(sum(1 for i in range(isqrt(n**n)+1) if len(d:=sorted(digits(i*i, n)[1:])) == d[-1]-d[0]+1 == len(set(d))))
%o A370370 print([a(n) for n in range(2, 12)]) # _Michael S. Branicky_, Feb 23 2024
%Y A370370 Cf. A215014, A370362, A370369, A370371, A370610, A370611.
%Y A370370 Cf. A258103 (number of pandigital squares in base n).
%K A370370 nonn,base,hard,more
%O A370370 2,1
%A A370370 _Jianing Song_, Feb 16 2024
%E A370370 a(15)-a(17) from _Michael S. Branicky_, Feb 23 2024