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.

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

A175134 a(n) = number of pairs of permutations (p, q) of the same (arbitrary) size m such that f_m(f_{m-1}(...f_1(1)...)) = n, where f_i(x) = p_i*x + q_i.

Original entry on oeis.org

1, 1, 0, 0, 2, 1, 1, 0, 0, 0, 0, 0, 2, 4, 4, 4, 2, 4, 1, 3, 1, 2, 2, 1, 1, 0, 0, 2, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 6, 4, 8, 6, 8, 6, 8, 6, 16, 12, 14, 6, 12, 10, 16, 18, 14, 14, 10, 10, 10, 14, 12, 10, 10, 8, 4, 13, 15, 4, 13, 6, 8, 6, 8, 2, 11, 6, 5, 7, 2, 11, 7, 6, 6, 5, 3, 6, 6, 2, 5, 2, 4, 3, 4, 3, 3, 1, 3, 5, 5, 1, 2, 3, 2, 0, 3, 2, 2, 3, 3, 4, 4, 3, 4, 2, 0, 2, 3, 2, 0, 1, 3, 2, 3, 1, 1, 1, 0, 1, 4, 2, 2, 1, 4, 1, 2, 0, 2, 3, 6, 0, 1, 1, 0, 1, 3, 3, 2, 0, 2, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Leroy Quet, Feb 21 2010

Keywords

Comments

For a fixed m, the smallest value of f_m(f_{m-1}(...f_1(1)...)) is achieved on the pair ((m,m-1,...,1), (1,2,...,m)) and is given by A370369(m) + m = A014144(m) + m!. Hence, to compute a(n) one can restrict m to those satisfying A014144(m) + m! <= n. - Max Alekseyev, Jan 29 2025

Examples

			For n = 13, suitable pairs of permutations are ((3,2,1),(1,2,3)) and ((3,2,1),(1,3,2)).
		

Crossrefs

Extensions

Edited and terms a(14) onward added by Max Alekseyev, Jan 29 2025.

A175135 Numbers k such that there exist permutations p, q of some size m such that k = f_m(f_{m-1}(...f_1(1)...)), where f_i(x) = p_i*x + q_i.

Original entry on oeis.org

1, 2, 5, 6, 7, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 28, 29, 31, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 132, 133, 134, 135, 136, 137, 138, 139, 141, 142, 143, 145, 146, 148, 149, 150, 151, 153, 154, 157, 161, 162, 163, 165
Offset: 1

Views

Author

Leroy Quet, Feb 21 2010

Keywords

Comments

Also, numbers k such that A175134(k) >= 1.
For a fixed m, the smallest value of f_m(f_{m-1}(...f_1(1)...)) is achieved on the pair ((m,m-1,...,1), (1,2,...,m)) and is given by A370369(m) + m = A014144(m) + m!. - Max Alekseyev, Jan 29 2025

Crossrefs

Extensions

a(7) onward from Max Alekseyev, Dec 27 2024
Edited by Max Alekseyev, Jan 29 2025
Showing 1-3 of 3 results.