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-10 of 10 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

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.

Original entry on oeis.org

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

Views

Author

Jianing Song, Feb 16 2024

Keywords

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

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.
		

Crossrefs

Cf. A215014, A370362, A370370, A258103 (number of pandigital squares in base n).
The actual squares are given by A370611.

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

A370610 Squares such that any two consecutive decimal digits differ by 1 after arranging the digits in decreasing order.

Original entry on oeis.org

0, 1, 4, 9, 324, 576, 4356, 5476, 23104, 32041, 13527684, 13675204, 17430625, 21307456, 34857216, 35617024, 43507216, 56731024, 65318724, 73256481, 81432576, 102576384, 105637284, 139854276, 152843769, 157326849, 158306724, 176305284, 180472356, 183467025, 187635204
Offset: 1

Views

Author

Jianing Song, Feb 23 2024

Keywords

Comments

Squares in A215014. There are 160 terms in this sequence.

Crossrefs

Cf. A215014, A370370. Supersequence of A036745.
The square roots are given by A370362.

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) = issquare(n) && isconsecutive(n)
    
  • Python
    from math import isqrt
    from sympy.ntheory import digits
    def afull(): return([i*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

A288780 Zero together with the row sums of A288778.

Original entry on oeis.org

0, 0, 2, 9, 36, 165, 918, 6111, 47304, 416097, 4091130, 44417043, 527456556, 6798432069, 94499679582, 1408924024695, 22425642181008, 379514672913321, 6804212771165634, 128827325000617947, 2568509718703606260, 53787877376348226573, 1180349932648067726886
Offset: 0

Views

Author

Omar E. Pol, Jun 15 2017

Keywords

Comments

For n >= 2, a(n) is the number of numbers in base n with consecutive digits after reordering.
a(10) = 4091130 is also the number of positive terms in the finite sequence A215014, hence a(10) + 1 = 4091131 is the total number of terms in that sequence.

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<3, n*(n-1),
          n*(a(n-1)*n/(n-1)-a(n-2)*(n-1)/(n-2)))
        end:
    seq(a(n), n=0..25);  # Alois P. Heinz, Jun 16 2017
  • Mathematica
    {0}~Join~Map[Total, Table[(n - k + 1) k! - (k - 1)!, {n, 22}, {k, n}]] (* Michael De Vlieger, Jun 21 2017 *)

Extensions

More terms from Alois P. Heinz, Jun 16 2017

A370369 a(n) = n! + Sum_{k=1..n-1} (n-k)*k! = n! + A014145(n-1); for n >= 2, number of m such that any two consecutive digits of the base-n expansion of m differ by 1 after arranging the digits in decreasing order.

Original entry on oeis.org

1, 3, 10, 37, 166, 919, 6112, 47305, 416098, 4091131, 44417044, 527456557, 6798432070, 94499679583, 1408924024696, 22425642181009, 379514672913322, 6804212771165635, 128827325000617948, 2568509718703606261, 53787877376348226574, 1180349932648067726887, 27086018941198865627200
Offset: 1

Views

Author

Jianing Song, Feb 16 2024

Keywords

Comments

Given n, the largest such number is Sum_{i=0..n-1} i*n^i = A062813(n). If zero is excluded, the number of such k with d digits in base n, 1 <= d <= n, is (n+1-d)*d! - (d-1)!.

Examples

			a(3) = 10 because such numbers are 0_3, 1_3, 2_3, 10_3, 12_3, 21_3, 102_3, 120_3, 201_3 and 210_3.
a(10) = 4091131 is the number of terms of A215014.
		

Crossrefs

Programs

  • PARI
    a(n) = n! + sum(k=1, n-1, (n-k)*k!)

A288528 Numbers with consecutive positive decimal digits after the digits are sorted.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 21, 23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 78, 87, 89, 98, 123, 132, 213, 231, 234, 243, 312, 321, 324, 342, 345, 354, 423, 432, 435, 453, 456, 465, 534, 543, 546, 564, 567, 576, 645, 654, 657, 675, 678, 687, 756, 765, 768, 786, 789, 798, 867, 876, 879, 897, 978, 987
Offset: 1

Views

Author

Omar E. Pol, Jun 15 2017

Keywords

Comments

The last term is a(462331) = 987654321.
Observation: the number of terms mentioned above is also A014145(9). Also the sum of the 9th row in the triangle A288777.
It appears that the number of terms with k digits in this sequence is also A288777(9,k), k>=1.

Crossrefs

Subsequence of A215014.
Supersequence of A138141.

Programs

  • Python
    def ok(n): return "".join(sorted(str(n))) in "123456789"
    print([k for k in range(999) if ok(k)]) # Michael S. Branicky, Aug 04 2022
    
  • Python
    # alternate for generating full sequence instantly
    from itertools import permutations
    frags = ["123456789"[i:j] for i in range(9) for j in range(i+1, 10)]
    afull = sorted(int("".join(s)) for f in frags for s in permutations(f))
    print(afull[:70]) # Michael S. Branicky, Aug 04 2022

A288778 Triangle read by rows (1<=k<=n): T(n,k) = (n-k+1)*k! - (k-1)!

Original entry on oeis.org

0, 1, 1, 2, 3, 4, 3, 5, 10, 18, 4, 7, 16, 42, 96, 5, 9, 22, 66, 216, 600, 6, 11, 28, 90, 336, 1320, 4320, 7, 13, 34, 114, 456, 2040, 9360, 35280, 8, 15, 40, 138, 576, 2760, 14400, 75600, 322560, 9, 17, 46, 162, 696, 3480, 19440, 115920, 685440, 3265920, 10, 19, 52, 186, 816, 4200, 24480, 156240, 1048320, 6894720, 36288000
Offset: 1

Views

Author

Omar E. Pol, Jun 15 2017

Keywords

Comments

T(10,k) is also the number of positive integers with k digits in the sequence A215014. See Franklin T. Adams-Watters's comment in that entry. See also A288780.

Examples

			Triangle begins:
0;
1,   1;
2,   3,  4;
3,   5, 10,  18;
4,   7, 16,  42,  96;
5,   9, 22,  66, 216,  600;
6,  11, 28,  90, 336, 1320,  4320;
7,  13, 34, 114, 456, 2040,  9360,  35280;
8,  15, 40, 138, 576, 2760, 14400,  75600,  322560;
9,  17, 46, 162, 696, 3480, 19440, 115920,  685440, 3265920;
10, 19, 52, 186, 816, 4200, 24480, 156240, 1048320, 6894720, 36288000;
...
For n = 10 and k = 2; T(10,2) = 17 coincides with the number of positive terms with two digits in A215014 (see the first comment above).
		

Crossrefs

Column 1 gives A001477.
Row sums give A288780.

Programs

  • Mathematica
    Table[(n - k + 1) k! - (k - 1)!, {n, 11}, {k, n}] // Flatten (* Michael De Vlieger, Jun 16 2017 *)

Formula

T(n,k) = A288777(n,k) - A000142(k-1), n>=1.

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

A352927 Numbers whose digits are nonzero, consecutive, and all increasing or all decreasing.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 21, 23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 78, 87, 89, 98, 123, 234, 321, 345, 432, 456, 543, 567, 654, 678, 765, 789, 876, 987, 1234, 2345, 3456, 4321, 4567, 5432, 5678, 6543, 6789, 7654, 8765, 9876, 12345, 23456, 34567, 45678, 54321, 56789, 65432, 76543, 87654, 98765, 123456, 234567, 345678
Offset: 1

Views

Author

N. J. A. Sloane, May 01 2022, following a suggestion from Ralph Sieber

Keywords

Comments

There are 81 terms, corresponding to numbers that start with i and end with j, for 1 <= i <= 9, 1 <= j <= 9. - Michael S. Branicky, May 01 2022

Crossrefs

Programs

  • Mathematica
    Join[Range[9],Select[Range[350000],DigitCount[#,10,0]==0&&(Union[Differences[IntegerDigits[ #]]]=={1}||Union[Differences[IntegerDigits[#]]]=={-1})&]] (* Harvey P. Dale, Aug 13 2023 *)
  • Python
    def sgn(n): return 1 if n >= 0 else -1
    def afull(): return sorted(int("".join(map(str, range(i, j+sgn(j-i), sgn(j-i))))) for i in range(1, 10) for j in range(1, 10))
    print(afull()) # Michael S. Branicky, May 01 2022
Showing 1-10 of 10 results.