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 19 results. Next

A134748 a(n)=largest permutational number of order n - smallest permutational number of order n+1 : A062813(n)-A134703(n+1) : A134640(!n)-A134640(!n+1).

Original entry on oeis.org

-1, -3, -6, 34, 1065, 21915, 458276, 10381380, 257910255, 7023426505, 208771773342, 6739114316358, 235020287563061, 8812102803936999, 353674208662429320, 15133351271499561736, 687862113868372542939, 33104027829427142199381
Offset: 1

Views

Author

Artur Jasinski, Nov 08 2007, Nov 10 2007

Keywords

Crossrefs

Programs

  • Mathematica
    a = {}; d = {}; e = {-1}; Do[b = {}; c = {}; Do[If[k > 0, AppendTo[b, k]]; AppendTo[c, n - k], {k, 0, n}] ; AppendTo[a, FromDigits[b, n + 1]]; AppendTo[d, FromDigits[c, n + 1]], {n, 1, 30}]; Do[AppendTo[e, d[[n]] - a[[n + 1]]], {n, 1, 29}]; e

A023812 Duplicate of A062813.

Original entry on oeis.org

0, 2, 21, 228, 2930, 44790, 800667, 16434824, 381367044, 9876543210
Offset: 1

Views

Author

Keywords

A023811 Largest metadrome (number with digits in strict ascending order) in base n.

Original entry on oeis.org

0, 1, 5, 27, 194, 1865, 22875, 342391, 6053444, 123456789, 2853116705, 73686780563, 2103299351334, 65751519677857, 2234152501943159, 81985529216486895, 3231407272993502984, 136146740744970718253, 6106233505124424657789, 290464265927977839335179
Offset: 1

Views

Author

Keywords

Comments

Also smallest zeroless pandigital number in base n. - Franklin T. Adams-Watters, Nov 15 2006
The smallest permutational number in A134640 in the n-positional system. - Artur Jasinski, Nov 07 2007

Examples

			a(5) = 1234[5] (in base 5) = 1*5^3 + 2*5^2 + 3*5 + 4 = 125 + 50 + 15 + 4 = 194.
a(10) = 123456789 (in base 10).
		

Crossrefs

Programs

  • Haskell
    a023811 n = foldl (\val dig -> val * n + dig) 0 [0 .. n - 1]
    -- Reinhard Zumkeller, Aug 29 2014
    
  • Magma
    [0] cat [(n^n-n^2+n-1)/(n-1)^2: n in [2..20]]; // Vincenzo Librandi, May 22 2012
    
  • Maple
    0, seq((n^n-n^2+n-1)/(n-1)^2, n=2..100); # Robert Israel, Dec 13 2015
  • Mathematica
    Table[Total[(#1 n^#2) & @@@ Transpose@ {Range[n - 1], Reverse@ (Range[n - 1] - 1)}], {n, 20}] (* Michael De Vlieger, Jul 24 2015 *)
    Table[Sum[(b - k)*b^(k - 1), {k, b - 1}], {b, 30}] (* Clark Kimberling, Aug 22 2015 *)
    Table[FromDigits[Range[0, n - 1], n], {n, 20}] (* L. Edson Jeffery, Dec 13 2015 *)
  • PARI
    {for(i=1,18,cuo=0; for(j=1,i-1,cuo=cuo+j*i^(i-j-1)); print1(cuo,", "))} \\\ Douglas Latimer, May 16 2012
    
  • PARI
    A023811(n)=if(n>1,(n^n-n^2)\(n-1)^2+1)  \\ M. F. Hasler, Jan 22 2013
    
  • Python
    def a(n): return (n**n - n**2 + n - 1)//((n - 1)**2) if n > 1 else 0
    print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Apr 24 2023

Formula

a(n) = Sum_{j=1...n-1} j*n^(n-1-j).
lim_{n->infinity} a(n)/a(n-1) - a(n-1)/a(n-2) = exp(1). - Conjectured by Gerald McGarvey, Sep 26 2004. Follows from the formula below and lim_{n->infinity} (1+1/n)^n = e. - Franklin T. Adams-Watters, Jan 25 2010
a(n) = (n^n-n^2+n-1)/(n-1)^2 = A058128(n)-1 = n*A060073(n)-1 (for n>=2). - Henry Bottomley, Feb 21 2001

Extensions

Edited by M. F. Hasler, Jan 22 2013

A134640 Permutational numbers (numbers with k different digits in k-positional system).

Original entry on oeis.org

0, 1, 2, 5, 7, 11, 15, 19, 21, 27, 30, 39, 45, 54, 57, 75, 78, 99, 108, 114, 120, 135, 141, 147, 156, 177, 180, 198, 201, 210, 216, 225, 228, 194, 198, 214, 222, 238, 242, 294, 298, 334, 346, 358, 366, 414, 422, 434, 446, 482, 486, 538, 542, 558, 566, 582, 586
Offset: 1

Views

Author

Artur Jasinski, Nov 05 2007, Nov 07 2007, Nov 08 2007

Keywords

Comments

Note that leading zeros are allowed in these numbers.
a(1) is the 1-positional system 1!=1 numbers
a(2) to a(3) are two=2! 2-positional system numbers
a(4) to a(9) are six=3! 3-positional system numbers
a(10) to a(33) are 24=4! 4-positional system numbers
a(34) to a(153) are 120=5! 5-positional system numbers
...
There are a(!k)-a(Sum[m!,1,k])=a(A003422)-a(A007489) k-positional system k! numbers
The name permutational numbers arises because each permutation of k elements is isomorphic with one and only one of member of this sequence and conversely each number in this sequence is isomorphic with one and only one permutation of k elelmnts or its equivalent permutation matrix.
T(n,1) = A023811(n); T(n,A000142(n)) = A062813(n). - Reinhard Zumkeller, Aug 29 2014

Examples

			We build permutational numbers:
a(1)=0 in unitary positional system we have only one digit 0
a(2)=1 because in binary positional system smaller number with two different digits is 01 = 1
a(3)=2 because in binary positional system bigger number with two different digits is 10 = 2 (binary system is over)
a(4)=5 because smallest number in ternary system with 3 different digits is 012=5
a(5)=7 second number in ternary system with 3 different digits is 021=7
a(6)=11 third number in ternary system with 3 different digits is 102=11
a(7)=15 120=15
etc.
		

Crossrefs

Cf. A003422, A007489, A061845, A000142 (row lengths excluding 1st term).
Cf. A023811, A062813, A000142 (row lengths), A007489 (sums of row lengths).

Programs

  • Haskell
    import Data.List (permutations, sort)
    a134640 n k = a134640_tabf !! (n-1) !! (k-1)
    a134640_row n = sort $
       map (foldr (\dig val -> val * n + dig) 0) $ permutations [0 .. n - 1]
    a134640_tabf = map a134640_row [1..]
    a134640_list = concat a134640_tabf
    -- Reinhard Zumkeller, Aug 29 2014
    
  • Mathematica
    a = {}; b = {}; Do[AppendTo[b, n]; w = Permutations[b]; Do[j = FromDigits[w[[m]], n + 1]; AppendTo[a, j], {m, 1, Length[w]}], {n, 0, 5}]; a (*Artur Jasinski*)
    Flatten[Table[FromDigits[#,n]&/@Permutations[Range[0,n-1]],{n,5}]] (* Harvey P. Dale, Dec 09 2014 *)
  • Python
    from itertools import permutations
    def fd(d, b): return sum(di*b**i for i, di in enumerate(d[::-1]))
    def row(n): return [fd(d, n) for d in permutations(range(n))]
    print([an for r in range(1, 6) for an in row(r)]) # Michael S. Branicky, Oct 21 2022

Extensions

Corrected indices in examples. Replaced dashes in comments by the word "to" - R. J. Mathar, Aug 26 2009

A109303 Numbers k with at least one duplicate base-10 digit (A107846(k) > 0).

Original entry on oeis.org

11, 22, 33, 44, 55, 66, 77, 88, 99, 100, 101, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 121, 122, 131, 133, 141, 144, 151, 155, 161, 166, 171, 177, 181, 188, 191, 199, 200, 202, 211, 212, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 232, 233, 242
Offset: 1

Views

Author

Rick L. Shepherd, Jun 24 2005

Keywords

Comments

Complement of A010784, numbers with distinct base-10 digits, so all numbers greater than 9876543210 (last term of A010784) are terms. a(263)=1001 is the first term not also a term of A044959; a(264)=1002 is the first term not also a term of A084050. The terms of A044959 greater than 9 are a subsequence. The terms of A084050 greater than 90 are a subsequence.
A178788(a(n)) = 0; A178787(a(n)) = A178787(a(n)-1); A043537(a(n)) < A109303(a(n)). - Reinhard Zumkeller, Jun 30 2010
A227362(a(n)) < a(n). - Reinhard Zumkeller, Jul 09 2013

Crossrefs

Cf. A010784 (numbers with distinct digits), A044959 (numbers with no two equally numerous digits), A084050 (numbers with a palindromic permutation of digits), A107846 (number of duplicate digits of n). Also see A062813, which gives the largest number in each base containing all distinct digits.

Programs

  • Haskell
    a109303 n = a109303_list !! (n-1)
    a109303_list = filter ((> 0) . a107846) [0..]
    -- Reinhard Zumkeller, Jul 09 2013
    
  • Mathematica
    Select[Range[300], Max[DigitCount[#]] > 1 &] (* Harvey P. Dale, Jan 14 2011 *)
  • Python
    def ok(n): s = str(n); return len(set(s)) < len(s)
    print([k for k in range(243) if ok(k)]) # Michael S. Branicky, Nov 22 2021

A061845 Numbers that have one of every digit in some base.

Original entry on oeis.org

2, 11, 15, 19, 21, 75, 78, 99, 108, 114, 120, 135, 141, 147, 156, 177, 180, 198, 201, 210, 216, 225, 228, 694, 698, 714, 722, 738, 742, 894, 898, 954, 970, 978, 990, 1014, 1022, 1054, 1070, 1102, 1110, 1138, 1142, 1178, 1190, 1202, 1210, 1294, 1298, 1334
Offset: 2

Views

Author

Erich Friedman, Jun 23 2001

Keywords

Comments

Also known as pandigital numbers, especially in base 10.

Examples

			Base 3 values are 102_3 = 11, 120_3 = 15, 201_3 = 19, 210_3 = 21.
Triangle begins:
    2;
   11,  15,  19,  21;
   75,  78,  99, 108, 114, 120, 135, 141, 147, 156, 177, 180,  198,  201, ...
  694, 698, 714, 722, 738, 742, 894, 898, 954, 970, 978, 990, 1014, 1022, ...
  ...
		

Crossrefs

Column k=1 gives A049363 (for n>1).
Last elements of rows give A062813.
Cf. A050278, A134640, A001563 (row lengths).

Programs

  • Mathematica
    dtn[ L_, base_ ] := Fold[ base*#1+#2&, 0, L ] f[ n_ ] := Map[ dtn[ #, n ]&, Select[ Permutations[ Range[ 0, n-1 ] ], First[ # ]>0& ] ] Flatten[ Join[ Table[ f[ i ], {i, 2, 5} ] ] ]

A258103 Number of pandigital squares (containing each digit exactly once) in base n.

Original entry on oeis.org

0, 0, 1, 0, 1, 3, 4, 26, 87, 47, 87, 0, 547, 1303, 3402, 0, 24192, 187562
Offset: 2

Views

Author

Adam J.T. Partridge, May 20 2015

Keywords

Comments

For n = 18, the smallest and largest pandigital squares are 2200667320658951859841 and 39207739576969100808801. For n = 19, they are 104753558229986901966129 and 1972312183619434816475625. For n = 20, they are 5272187100814113874556176 and 104566626183621314286288961. - Chai Wah Wu, May 20 2015
When n is even, (n-1) is a factor of the pandigital squares. When n is odd, (n-1)/2 is a factor with the remaining factors being odd. Therefore, when n is odd and (n-1)/2 has an odd number of 2s as prime factors there are no pandigital squares in base n (e.g. 5, 13, 17 and 21). - Adam J.T. Partridge, May 21 2015
If n is odd and (n-1)/2 has an odd 2-adic valuation, then there are no squares in base n using all the digits from 1 to n-1 once, or all the digits from 0 to n-2 once or all the digits from 1 to n-2 once. This can be proved using the same argument as in the linked blogposts. - Chai Wah Wu, Feb 25 2024

Examples

			For n=4 there is one pandigital square, 3201_4 = 225 = 15^2.
For n=6 there is one pandigital square, 452013_6 = 38025 = 195^2.
For n=10 there are 87 pandigital squares (A036745).
There are no pandigital squares in bases 2, 3, 5 or 13.
Hexadecimal has 3402 pandigital squares, the largest is FED5B39A42706C81.
		

Crossrefs

Programs

  • PARI
    a(n) = if(n%2==1 && valuation(n-1,2)%2==0, 0, my(lim=sqrtint(n^n - (n^n-n)/(n-1)^2), count=0); for(m=sqrtint((n^n-n)/(n-1)^2 + n^(n-2)*(n-1) - 1), lim, if(#Set(digits(m^2,n))==n, count++)); count) \\ Jianing Song, Feb 23 2024. Note that the searching range for m is [sqrt(A049363(n)), sqrt(A062813(n))]
  • Python
    from gmpy2 import isqrt, mpz, digits
    def A258103(n): # requires 2 <= n <= 62
        c, sm, sq = 0, mpz(''.join([digits(i, n) for i in range(n-1, -1, -1)]), n), mpz(''.join(['1', '0']+[digits(i, n) for i in range(2, n)]), n)
        m = isqrt(sq)
        sq = m*m
        m = 2*m+1
        while sq <= sm:
            if len(set(digits(sq, n))) == n:
                c += 1
            sq += m
            m += 2
        return c # Chai Wah Wu, May 20 2015
    

Extensions

a(17)-a(19) from Giovanni Resta, May 20 2015

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

A068792 a(n) = (n-1)*n^(n-2) + Sum_{i=1..n} (n-i)*(n^(n-i-1) + n^(n+i-3)).

Original entry on oeis.org

1, 16, 441, 24336, 2418025, 384473664, 89755965649, 28953439105600, 12345678987654321, 6727499948806851600, 4562491230669011577289, 3769449794266138309731600, 3727710895159027432980276121, 4348096581244536814777202995456, 5907679981266292758213173560296225
Offset: 2

Views

Author

Reinhard Zumkeller, Mar 04 2002

Keywords

Comments

a(n) is a palindrome in base n representation for all n.

Examples

			a(8) = 89755965649 = (1234567654321)OCT;
a(10) = 12345678987654321 = A057139(9);
a(16) = 5907679981266292758213173560296225 = (123456789ABC...987654321)HEX.
		

Crossrefs

Programs

  • Magma
    [((n^(n-1) -1)/(n-1))^2: n in [2..30]]; // G. C. Greubel, Aug 16 2022
    
  • Mathematica
    Table[((n^(n-1) -1)/(n-1))^2, {n,2,30}] (* G. C. Greubel, Aug 16 2022 *)
  • Python
    def A068792(n): return ((n**(n-1)-1)//(n-1))**2 # Chai Wah Wu, Mar 18 2024
  • SageMath
    [((n^(n-1) -1)/(n-1))^2 for n in (2..30)] # G. C. Greubel, Aug 16 2022
    

Formula

a(n) = ( (n^(n-1) - 1)/(n-1) )^2.
a(n) = ((A023811(n) - n + 1)/n)*n^(n-1) + A062813(n)/n.
a(n) = A060072(n)^2.

Extensions

More terms from G. C. Greubel, Aug 16 2022

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!)
Showing 1-10 of 19 results. Next