Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Search: a258103 -id:a258103
     Sort: relevance | references | number | modified | created      Format: long | short | data
Number of squares such that any two consecutive digits of their base-n expansions differ by 1 after arranging the digits in decreasing order.
+10
4
2, 2, 6, 3, 10, 12, 14, 48, 160, 148, 226, 54, 1277, 2675, 6812, 2525
OFFSET
2,1
EXAMPLE
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.
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.
a(10) = 160 because there are 160 terms in A370362 (or A370610).
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) = 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
(Python) # replace n**n with ub in A370371 for faster version
from math import isqrt
from sympy.ntheory import digits
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))))
print([a(n) for n in range(2, 12)]) # Michael S. Branicky, Feb 23 2024
CROSSREFS
Cf. A258103 (number of pandigital squares in base n).
KEYWORD
nonn,base,hard,more
AUTHOR
Jianing Song, Feb 16 2024
EXTENSIONS
a(15)-a(17) from Michael S. Branicky, Feb 23 2024
STATUS
approved
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.
+10
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.
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
All pandigital squares which contain each digit exactly once in some base b >= 2. The numbers are written in base 10.
+10
2
225, 38025, 314721, 622521, 751689, 3111696, 6002500, 7568001, 10323369, 61058596, 73513476, 74545956, 94517284, 105144516, 112572100, 112656996, 132756484, 136936804, 181980100, 202948516, 210308004, 211353444, 219573124, 222069604, 230614596, 238208356, 251983876
OFFSET
1,1
COMMENTS
The sequence consists of all square numbers which when represented in some base b contain all the b digits in that base exactly once.
A225218 has all the squares in base 10 that are pandigital. This sequence is the union of all such sequences in any integer base b >= 2.
LINKS
EXAMPLE
15^2 in base 4 (225 is 3201 in base 4) contains the digits 0-3.
195^2 in base 6 (38025 is 452013 in base 6) contains the digits 0-5.
The next three terms contain all the digits in base 7.
The following four entries are pandigital in base 8, the next 26 in base 9, and so on.
PROG
(JAI)
#import "Basic";
dstr := "0123456789abcdef";
main :: () {
digits : [16] int;
for j:2..3_000_000 {
for b:3..16 {
for d : 0..15
digits[d] = 0;
k := j*j;
s := tprint( "%", formatInt( k, b ) );
if s.count > b
continue;
for d : 0..s.count-1 {
for c : 0..dstr.count-1 {
if s[d] == dstr[c] {
digits[c] += 1;
continue d;
}
}
}
for d : 0..b-1 {
if digits[d] != 1
continue b;
}
print( "%, ", k );
}
}
}
(PARI) \\ here ispandig(n) returns base if n is pandigital, otherwise 0.
ispandig(n)={for(b=2, oo, my(r=logint(n, b)+1); if(r<b, break); if(r==b && #Set(digits(n, b))==b, return(b))); 0}
for(n=1, 10^5, if(ispandig(n^2), print1(n^2, ", "))) \\ Andrew Howroyd, Dec 20 2020
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
David Schilling, Dec 13 2020
STATUS
approved
Smallest square which when written in base b contains each digit exactly once, or -1 if no such square exists.
+10
2
-1, -1, 225, -1, 38025, 314721, 3111696, 61058596, 1026753849, 31529329225, 892067027049, -1, 803752551280900, 29501156485626049, 1163446635475467225, -1, 2200667320658951859841, 104753558229986901966129, 5272187100814113874556176, -1, 15588378150732414428650569369
OFFSET
2,3
COMMENTS
Note that "pandigital" just means every digit appears at least once. The condition here is stronger. Maybe this should be called "Smallest strictly pandigital square in base b"?
Does this sequence contain infinitely many positive terms? Equally, is A339693 infinite?
It is shown in A258103 that a(n) = -1 for n = 2,3,5,13,17,21 and infinitely many other values.
LINKS
EXAMPLE
base a(base) digits
4 225 [3, 2, 0, 1]
6 38025 [4, 5, 2, 0, 1, 3]
7 314721 [2, 4, 5, 0, 3, 6, 1]
8 3111696 [1, 3, 6, 7, 5, 4, 2, 0]
9 61058596 [1, 3, 6, 8, 0, 2, 5, 7, 4]
10 1026753849 [1, 0, 2, 6, 7, 5, 3, 8, 4, 9]
11 31529329225 [1, 2, 4, 0, 10, 5, 3, 6, 7, 8, 9]
12 892067027049 [1, 2, 4, 10, 7, 11, 5, 3, 8, 6, 0, 9]
14 803752551280900 [1, 0, 2, 6, 9, 11, 8, 12, 5, 7, 13, 3, 10, 4]
PROG
(Python)
from sympy import integer_nthroot
def digits(n, b):
out = []
while n >= b: n, r = divmod(n, b); out.append(r)
return [n] + out[::-1]
def a(n):
b, b2b = n, n**n
r, a = integer_nthroot(b**(b-1), 2); s = r**2
while s < b**(b-1): s += 2*r + 1; r += 1
while s < b2b:
if len(set(digits(s, b))) == n: return s
s += 2*r + 1; r += 1
return -1
print([a(n) for n in range(2, 13)]) # Michael S. Branicky, Jan 13 2021
CROSSREFS
Inspired by A258103, A260182, A339693.
KEYWORD
sign,base
AUTHOR
N. J. A. Sloane, Jan 13 2021
EXTENSIONS
a(10)-a(22) from Hugo Pfoertner and Alois P. Heinz, Jan 13 2021
STATUS
approved
Largest square such that any two consecutive digits of its base-n expansion differ by 1 after arranging the digits in decreasing order.
+10
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.
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
Number of penholodigital squares (containing each nonzero digit exactly once) in base n.
+10
1
1, 0, 0, 0, 2, 1, 1, 10, 30, 20, 23, 0, 160, 419, 740, 0, 5116
OFFSET
2,5
COMMENTS
From Chai Wah Wu, Mar 10 2024: (Start)
Theorem: Let m^2 be a pandigital square (containing each digit exactly once) or a penholodigital square (containing each nonzero digit exactly once) in base n. If n-1 is an odd squarefree number (A056911), then m is divisible by n-1. If n-1 is an even squarefree number (A039956), then m-(n-1)/2 is divisible by n-1.
Proof: Since n^k == 1 (mod n-1), and the sum of digits of m^2 is n*(n-1)/2, this implies that m^2 == n*(n-1)/2 (mod n-1). If n-1 is odd and squarefree, then n is even and m^2 == 0 (mod n-1). Since n-1 = Product_i p_i for distinct odd primes p_i, and m^2 == 0 (mod p_i) if and only if m == 0 (mod p_i), this implies that m == 0 (mod n-1) by the Chinese Remainder Theorem.
Similarly, if n-1 is even and squarefree, then m^2 == n(n-1)/2 == (n-1)/2 (mod n-1) and (n-1)/2 = Product_i p_i for distinct odd primes p_i, i.e., m^2 == 0 (mod p_i) and m^2 == 1 (mod 2). This implies that m == 0 (mod p_i) and m == 1 (mod 2). Again by the Chinese Remainder Theorem, m == (n-1)/2 (mod n-1).
(End)
LINKS
Chai Wah Wu, Pandigital and penholodigital numbers, arXiv:2403.20304 [math.GM], 2024. See p. 2.
FORMULA
If n is odd and n-1 has an even 2-adic valuation, then a(n) = 0 (see A258103).
EXAMPLE
For n=2 there is one penholodigital square, 1_2 = 1 = 1^2.
For n=6 there are two penholodigital squares, 15324_6 = 2500 = 50^2 and 53241_6 = 7225 = 85^2.
For n=7 there is one penholodigital square, 623514_7 = 106929 = 195^2.
For n=8 there is one penholodigital square, 6532471_8 = 1750329 = 1323^2.
For n=10 there are 30 penholodigital squares listed in A036744.
PROG
(Python)
from gmpy2 import mpz, digits, isqrt
def A370950(n): # requires 2 <= n <= 62
if n&1 and (~(m:=n-1>>1) & m-1).bit_length()&1:
return 0
t = ''.join(digits(d, n) for d in range(1, n))
k = mpz(''.join(digits(d, n) for d in range(n-1, 0, -1)), n)
k2 = mpz(t, n)
c = 0
for i in range(isqrt(k2), isqrt(k)+1):
if i%n:
j = i**2
s = ''.join(sorted(digits(j, n)))
if s == t:
c += 1
return c
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Chai Wah Wu, Mar 06 2024
EXTENSIONS
a(18) from Chai Wah Wu, Mar 07 2024
STATUS
approved

Search completed in 0.016 seconds