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.

Showing 1-3 of 3 results.

A370362 Numbers k such that any two consecutive decimal digits of k^2 differ by 1 after arranging the digits in decreasing order.

Original entry on oeis.org

0, 1, 2, 3, 18, 24, 66, 74, 152, 179, 3678, 3698, 4175, 4616, 5904, 5968, 6596, 7532, 8082, 8559, 9024, 10128, 10278, 11826, 12363, 12543, 12582, 13278, 13434, 13545, 13698, 14442, 14676, 14766, 15681, 15963, 16854, 17529, 17778, 18072, 19023, 19377, 19569, 19629
Offset: 1

Views

Author

Jianing Song, Feb 16 2024

Keywords

Comments

Numbers k such that k^2 is in A215014. There are 160 terms in this sequence.

Examples

			18^2 = 324 consists of the consecutive digits 2, 3 and 4;
24^2 = 576 consists of the consecutive digits 5, 6 and 7;
66^2 = 4356 consists of the consecutive digits 3, 4, 5 and 6;
74^2 = 5476 consists of the consecutive digits 4, 5, 6 and 7.
		

Crossrefs

Cf. A215014, A370370. Supersequence of A156977.
The actual squares are given by A370610.

Programs

  • PARI
    isconsecutive(m, {b=10})=my(v=vecsort(digits(m, b))); for(i=2, #v, if(v[i]!=1+v[i-1], return(0))); 1 \\ isconsecutive(k, b) == 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) = isconsecutive(n^2)
    
  • Python
    from math import isqrt
    from sympy.ntheory import digits
    def afull(): return([i for i in range(isqrt(10**10)+1) if len(d:=sorted(str(i*i))) == ord(d[-1])-ord(d[0])+1 == len(set(d))])
    print(afull()) # Michael S. Branicky, Feb 23 2024

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.

Original entry on oeis.org

2, 2, 6, 3, 10, 12, 14, 48, 160, 148, 226, 54, 1277, 2675, 6812, 2525
Offset: 2

Views

Author

Jianing Song, Feb 16 2024

Keywords

Examples

			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).
		

Crossrefs

Cf. A258103 (number of pandigital squares in base n).

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) = 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

Extensions

a(15)-a(17) from Michael S. Branicky, Feb 23 2024

A370611 Largest square such that any two consecutive digits of its base-n expansion differ by 1 after arranging the digits in decreasing order.

Original entry on oeis.org

1, 1, 225, 4, 38025, 751689, 10323369, 355624164, 9814072356, 279740499025, 8706730814089, 86847500601, 11027486960232964, 435408094460869201, 18362780530794065025, 2492638430009890761, 39207739576969100808801, 1972312183619434816475625, 104566626183621314286288961, 13215338757299095309775089
Offset: 2

Views

Author

Jianing Song, Feb 23 2024

Keywords

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

Examples

			See the Example section of A370371.
		

Crossrefs

Cf. A215014, A370370, A370610, A258103 (number of pandigital squares in base n).
The square roots are given by A370371.

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^2)))

Extensions

a(17)-a(20) from Michael S. Branicky, Feb 23 2024
a(21) from Chai Wah Wu, Feb 25 2024
Showing 1-3 of 3 results.