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.

A060501 Average of digits of each term in A060495, number of balls in each such siteswap juggling pattern.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 3, 2, 2, 1, 2, 2, 3, 2, 3, 2, 2, 2, 3, 3, 2, 2, 3, 3, 4, 3, 3, 2, 3, 3, 3, 2, 2, 1, 2, 2, 3, 2, 3, 2, 2, 2, 3, 3, 2, 2, 3, 3, 4, 3, 3, 2, 3, 3, 4, 3, 3, 2, 3, 3, 3, 2, 3, 2, 2, 2, 3, 3, 2, 2, 3, 3, 4, 3, 4, 3, 3, 3, 3, 2, 3, 2, 2, 2, 4, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 3, 3, 4, 4, 3, 3, 2
Offset: 0

Views

Author

Antti Karttunen, Mar 22 2001

Keywords

Crossrefs

Cf. A060500 (for avg), A060502.

Programs

  • Maple
    Perm2SiteSwap2 := proc(p) local ip,n,i,a; n := nops(p); ip := convert(invperm(convert(p,'disjcyc')),'permlist',n); a := []; for i from 1 to n do if(0 = ((ip[i]-i) mod n)) then a := [op(a), n]; else a := [op(a),((ip[i]-i) mod n)]; fi; od; RETURN(a); end;

Formula

a(n) = avg(Perm2SiteSwap2(PermUnrank3R(n)))

A064636 Number of derangements up to cyclic rotations; permutation siteswap necklaces, with no fixed points (no "zero-throws", i.e., empty hands, if we use the mapping Perm2SiteSwap1 of A060495 and A060498).

Original entry on oeis.org

0, 0, 1, 2, 5, 12, 55, 270, 1893, 14864, 133749, 1334970, 14687195, 176214852, 2290820923, 32071104006, 481066907653, 7697064251760, 130850098582189, 2355301661033970, 44750731672347273, 895014631193654828, 18795307257304746591, 413496759611120779902, 9510425471105377569963, 228250211305338670543432
Offset: 0

Views

Author

Antti Karttunen, Oct 02 2001

Keywords

Comments

This sequence counts derangements (enumerated by A000166) up to the same automorphism as permutations (enumerated by A000142) are subjected to in A061417.

Programs

  • Maple
    with(numtheory); A064636 := proc(n) local d,k,s; s := 0; for d in divisors(n) do s := s + (1/n) * phi(n/d) * ( (((n/d)^d)*A000166(d)) + add((((n/d)^(d-k)) * (((n/d)-1)^k) * (A000166(d-k)*binomial(d,k))),k=1..d)); od; RETURN(s); end;
  • Mathematica
    Unprotect[Power]; 0^0 = 1; a[n_] := (1/n) DivisorSum[n, EulerPhi[n/#]*Sum[ (n/#)^(# - k)*(n/# - 1)^k*#!*Gamma[# - k + 1, -1]/(E*k!*(# - k)!), {k, 0, #}]&] // FunctionExpand; a[0] = 0; Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Mar 06 2016 *)

Formula

a(n) = Sum_{d|n} (1/n) * Phi(n/d) * Sum_{k=0..d} [ ((n/d)^(d-k)) * (((n/d)-1)^k) * A008290(d, k) ]. (Note: this abbreviated formula supposes that 0^0 = 1. For a practical implementation, see the Maple procedure below.)

A007623 Integers written in factorial base.

Original entry on oeis.org

0, 1, 10, 11, 20, 21, 100, 101, 110, 111, 120, 121, 200, 201, 210, 211, 220, 221, 300, 301, 310, 311, 320, 321, 1000, 1001, 1010, 1011, 1020, 1021, 1100, 1101, 1110, 1111, 1120, 1121, 1200, 1201, 1210, 1211, 1220, 1221, 1300, 1301, 1310, 1311, 1320, 1321, 2000, 2001, 2010
Offset: 0

Views

Author

Keywords

Comments

Places reading from right have values (1, 2, 6, 24, 120, ...) = factorials.
Also the reversed inversion vectors for the list of all finite permutations in reversed lexicographic order: A055089.
This concatenated representation is unsatisfactory for large n (above 36287999), when coefficients of 10 or greater start to appear. For these large numbers the representation given in A108731 is better. - N. J. A. Sloane, Jun 04 2012
For n < 10*10!-1, a(n) = concatenation of n-th row of triangle in A108731. - Reinhard Zumkeller, Jun 04 2012
a(n) = A049345(n) for n=0..23. - Reinhard Zumkeller, Jan 05 2014
For n = 36288000 = 10 * 10!, the digits in factorial base are {10, 0, 0, 0, 0, 0, 0, 0, 0, 0}. - Michael De Vlieger, Oct 11 2015, corrected and edited by M. F. Hasler, Nov 27 2018
The alt text in xkcd comic #2835 describes "Numbers larger than about 3.6 million" to be illegal. See links. - David Cleaver, Sep 30 2023

Examples

			a(47) = 1321 because 47 = 1*4! + 3*3! + 2*2! + 1*1!
		

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 2, p. 192.
  • F. Smarandache, Definitions solved and unsolved problems, conjectures and theorems in number theory and geometry, edited by M. Perez, Xiquan Publishing House, 2000.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000142, A034968 (sum of digits), A060130 (number of nonzero digits), A099563 (the most significant digit).
Cf. also A055089, A055881, A060112, A060495. Permutation of A064039.
See index entry "factorial base representation" for many more related sequences.
See also primorial base A049345.

Programs

  • Haskell
    a007623 n | n <= 36287999 = read $ concatMap show (a108731_row n) :: Int
              | otherwise     = error "representation would be ambiguous"
    -- Reinhard Zumkeller, Jun 04 2012
    (Scheme, R6RS standard) (define (A007623 n) (let loop ((n n) (s 0) (p 1) (i 2)) (if (zero? n) s (let ((d (mod n i))) (loop (/ (- n d) i) (+ (* p d) s) (* 10 p) (+ 1 i)))))) ;; In older Schemes use modulo instead of mod. - Antti Karttunen, Feb 13 2016
    
  • Maple
    a := n -> if nargs<2 then a(n,2) elif n
    				
  • Mathematica
    factBaseIntDs[n_] := Module[{m, i, len, dList, currDigit}, i = 1; While[n > i!, i++ ]; m = n; len = i; dList = Table[0, {len}]; Do[ currDigit = 0; While[m >= j!, m = m - j!; currDigit++ ]; dList[[len - j + 1]] = currDigit, {j, i, 1, -1}]; If[dList[[1]] == 0, dList = Drop[dList, 1]]; dList]; Table[FromDigits[factBaseIntDs[n]], {n, 0, 50}] (* Alonso del Arte, May 03 2006 *)
    lim = 50; m = 1; While[Factorial@ m < lim, m++]; m; IntegerDigits[#, MixedRadix[Reverse@ Range[2, m]]] & /@ Range@ lim (* Michael De Vlieger, Oct 11 2015, Version 10.2 *)
  • PARI
    apply( a(n,p=2)=if(nM. F. Hasler, Mar 27 2007; minor edit Nov 26 2018
    
  • Python
    def a(n, p=2): return n if n

Extensions

More terms from R. K. Guy

A060117 A list of all finite permutations in "PermUnrank3R" ordering. (Inverses of the permutations of A060118.)

Original entry on oeis.org

1, 2, 1, 1, 3, 2, 3, 1, 2, 3, 2, 1, 2, 3, 1, 1, 2, 4, 3, 2, 1, 4, 3, 1, 4, 2, 3, 4, 1, 2, 3, 4, 2, 1, 3, 2, 4, 1, 3, 1, 4, 3, 2, 4, 1, 3, 2, 1, 3, 4, 2, 3, 1, 4, 2, 3, 4, 1, 2, 4, 3, 1, 2, 4, 2, 3, 1, 2, 4, 3, 1, 4, 3, 2, 1, 3, 4, 2, 1, 3, 2, 4, 1, 2, 3, 4, 1, 1, 2, 3, 5, 4, 2, 1, 3, 5, 4, 1, 3, 2, 5, 4, 3, 1, 2
Offset: 0

Views

Author

Antti Karttunen, Mar 02 2001

Keywords

Comments

PermUnrank3R and PermUnrank3L are slight modifications of unrank2 algorithm presented in Myrvold-Ruskey article.

Examples

			In this table each row consists of A001563[n] permutations of (n+1) terms; i.e., we have (1/) 2,1/ 1,3,2; 3,1,2; 3,2,1; 2,3,1/ 1,2,4,3; 2,1,4,3;
Append to each an infinite number of fixed terms and we get a list of rearrangements of natural numbers, but with only a finite number of terms permuted:
1/2,3,4,5,6,7,8,9,...
2,1/3,4,5,6,7,8,9,...
1,3,2/4,5,6,7,8,9,...
3,1,2/4,5,6,7,8,9,...
3,2,1/4,5,6,7,8,9,...
2,3,1/4,5,6,7,8,9,...
1,2,4,3/5,6,7,8,9,...
2,1,4,3/5,6,7,8,9,...
		

Crossrefs

A060119 = Positions of these permutations in the "canonical list" A055089 (where also the rest of procedures can be found). A060118 gives position of the inverse permutation of each and A065183 positions after Foata transform.
Inversion vectors: A064039.

Programs

  • Maple
    with(group); permul := (a,b) -> mulperms(b,a); PermUnrank3R := proc(r) local n; n := nops(factorial_base(r)); convert(PermUnrank3Raux(n+1,r,[]),'permlist',1+(((r+2) mod (r+1))*n)); end; PermUnrank3Raux := proc(n,r,p) local s; if(0 = r) then RETURN(p); else s := floor(r/((n-1)!)); RETURN(PermUnrank3Raux(n-1, r-(s*((n-1)!)), permul(p,[[n,n-s]]))); fi; end;

Formula

[seq(op(PermUnrank3R(j)), j=0..)]; (Maple code given below)

A061417 Number of permutations up to cyclic rotations; permutation siteswap necklaces.

Original entry on oeis.org

1, 2, 4, 10, 28, 136, 726, 5100, 40362, 363288, 3628810, 39921044, 479001612, 6227066928, 87178295296, 1307675013928, 20922789888016, 355687438476444, 6402373705728018, 121645100594641896, 2432902008177690360, 51090942175425331320, 1124000727777607680022
Offset: 1

Views

Author

Antti Karttunen, May 02 2001

Keywords

Comments

If permutations are converted to (i,p(i)) permutation arrays, then this automorphism is obtained by their "SW-NE diagonal toroidal shifts" (see Matthias Engelhardt's Java program in A006841), while the Maple procedure below converts each permutation to a siteswap pattern (used in juggling), rotates it by one digit and converts the resulting new (or same) siteswap pattern back to a permutation.
When the subset of permutations listed by A064640 are subjected to the same automorphism one gets A002995.
The number of conjugacy classes of the symmetric group of degree n when conjugating only with the cyclic permutation group of degree n. - Attila Egri-Nagy, Aug 15 2014
Also the number of equivalence classes of permutations of {1...n} under the action of rotation of vertices in the cycle decomposition. The corresponding action on words applies m -> m + 1 for m < n and n -> 1, and rotates once to the right. For example, (24531) first becomes (35142) under the application of cyclic rotation, and then is rotated right to give (23514). - Gus Wiseman, Mar 04 2019

Examples

			If I have a five-element permutation like 25431, in cycle notation (1 2 5)(3 4), I mark the numbers 1-5 clockwise onto a circle and draw directed edges from 1 to 2, from 2 to 5, from 5 to 1 and a double-way edge between 3 and 4. All the 5-element permutations that produce some rotation (discarding the labels of the nodes) of that chord diagram belong to the same equivalence class with 25431. The sequence gives the count of such equivalence classes.
		

Crossrefs

Cf. A006841, A060495. For other Maple procedures, see A060501 (Perm2SiteSwap2), A057502 (CountCycles), A057509 (rotateL), A060125 (PermRank3R and permul).
A061417[p] = A061860[p] = (p-1)!+(p-1) for all prime p's.
A064636 (derangements-the same automorphism).
A061417[n] = A064649[n]/n.
Cf. A000031, A000939, A002995, A008965, A060223, A064640, A086675 (digraphical necklaces), A179043, A192332, A275527 (path necklaces), A323858, A323859, A323870, A324513, A324514 (aperiodic permutations).

Programs

  • GAP
    List([1..10],n->Size( OrbitsDomain( CyclicGroup(IsPermGroup,n), SymmetricGroup( IsPermGroup,n),\^))); # Attila Egri-Nagy, Aug 15 2014
    
  • Haskell
    a061417 = sum . a047917_row  -- Reinhard Zumkeller, Mar 19 2014
    
  • Maple
    Algebraic formula: with(numtheory); SSRPCC := proc(n) local d,s; s := 0; for d in divisors(n) do s := s + phi(n/d)*((n/d)^d)*(d!); od; RETURN(s/n); end;
    Empirically: with(group); SiteSwapRotationPermutationCycleCounts := proc(upto_n) local b,u,n,a,r; a := []; for n from 1 to upto_n do b := []; u := n!; for r from 0 to u-1 do b := [op(b),1+PermRank3R(SiteSwap2Perm1(rotateL(Perm2SiteSwap2(PermUnrank3Rfix(n,r)))))]; od; a := [op(a),CountCycles(b)]; od; RETURN(a); end;
    PermUnrank3Rfixaux := proc(n,r,p) local s; if(0 = n) then RETURN(p); else s := floor(r/((n-1)!)); RETURN(PermUnrank3Rfixaux(n-1, r-(s*((n-1)!)), permul(p,[[n,n-s]]))); fi; end;
    PermUnrank3Rfix := (n,r) -> convert(PermUnrank3Rfixaux(n,r,[]),'permlist',n);
    SiteSwap2Perm1 := proc(s) local e,n,i,a; n := nops(s); a := []; for i from 1 to n do e := ((i+s[i]) mod n); if(0 = e) then e := n; fi; a := [op(a),e]; od; RETURN(convert(invperm(convert(a,'disjcyc')),'permlist',n)); end;
  • Mathematica
    a[n_] := (1/n)*Sum[ EulerPhi[n/d]*(n/d)^d*d!, {d, Divisors[n]}]; Table[a[n], {n, 1, 21}] (* Jean-François Alcover, Oct 09 2012, from formula *)
    Table[Length[Select[Permutations[Range[n]],#==First[Sort[NestList[RotateRight[#/.k_Integer:>If[k==n,1,k+1]]&,#,n-1]]]&]],{n,8}] (* Gus Wiseman, Mar 04 2019 *)
  • PARI
    a(n) = (1/n)*sumdiv(n, d, eulerphi(n/d)*(n/d)^d*d!); \\ Indranil Ghosh, Apr 10 2017
    
  • Python
    from sympy import divisors, factorial, totient
    def a(n):
        return sum(totient(n//d)*(n//d)**d*factorial(d) for d in divisors(n))//n
    print([a(n) for n in range(1, 22)]) # Indranil Ghosh, Apr 10 2017

Formula

a(n) = (1/n)*Sum_{d|n} phi(n/d)*((n/d)^d)*(d!).

A060498 Each permutation in the list A060117 converted to Site Swap notation, with digits reversed and inverted. "Zero throws" (fixed elements) indicated with 0's.

Original entry on oeis.org

0, 11, 120, 222, 201, 111, 1300, 1313, 2330, 3333, 3302, 2312, 2020, 3023, 1120, 1223, 2222, 3122, 3001, 2011, 3131, 2231, 1201, 1111, 14000, 14014, 14140, 14244, 14203, 14113, 24400, 24414, 34440, 44444, 44403, 34413, 34030, 44034, 24130
Offset: 0

Views

Author

Antti Karttunen, Mar 22 2001

Keywords

Comments

This sequence is not well-defined for n >= 3628800 because the Site Swap notation can contain values exceeding 9, for example, the Site Swap notation for a(3628800) is [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 10]. - Sean A. Irvine, Nov 25 2022

Crossrefs

Cf. A060495, A060496, A060499. Average of digits gives number of balls: A060502.

Programs

  • Maple
    SiteSwap3ToDec := proc(s) local i,z,n; n := nops(s); z := 0; for i from n by -1 to 1 do z := 10*z; if(s[i] > 0) then z := z + (n-s[i]); fi; od; RETURN(z); end;

Formula

a(n) = SiteSwap3ToDec(Perm2SiteSwap1(PermUnrank3R(n))).

A060496 Each permutation in the list A060117 converted to Site Swap notation, with digits reversed. "Zero throws" (fixed elements) indicated with 0's.

Original entry on oeis.org

0, 11, 210, 111, 102, 222, 3100, 3131, 2110, 1111, 1102, 2132, 2020, 1021, 3320, 3221, 2222, 1322, 1003, 2033, 1313, 2213, 3203, 3333, 41000, 41041, 41410, 41311, 41302, 41442, 31100, 31141, 21110, 11111, 11102, 21142, 21020, 11021, 31420
Offset: 0

Views

Author

Antti Karttunen, Mar 21 2001

Keywords

Comments

This sequence is not well-defined for n >= 3628800 because the Site Swap notation can contain values exceeding 9, for example, the Site Swap notation for a(3628800) is [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 10]. - Sean A. Irvine, Nov 25 2022

Crossrefs

Cf. factorial base representation A007623 and A060495, A006694.
In A060498 the digits are also "inverted", giving valid siteswap juggling patterns.

Programs

  • Maple
    SiteSwap2ToDec := proc(s) local i,z; z := 0; for i from nops(s) by -1 to 1 do z := 10*z + s[i]; od; RETURN(z); end;

Formula

a(n) = SiteSwap2ToDec(Perm2SiteSwap1(PermUnrank3R(n))).

A071160 Łukasiewicz words that are also valid asynchronic siteswap juggling patterns.

Original entry on oeis.org

0, 1, 20, 11, 300, 201, 120, 111, 4000, 3001, 2020, 2011, 1300, 1201, 1120, 1111, 50000, 40001, 30020, 30011, 20300, 20201, 20120, 20111, 14000, 13001, 12020, 12011, 11300, 11201, 11120, 11111, 600000, 500001, 400020, 400011, 300300
Offset: 0

Views

Author

Antti Karttunen, May 14 2002

Keywords

Comments

Note: this finite decimal representation works only up to the 511th term, as the 512th such word is already (10,0,0,0,0,0,0,0,0,0). The sequence A071161 shows the initial portion of this sequence sorted.

Crossrefs

Formula

Construction: starting from the most significant (the leftmost) bit, replace each 1-bit in the binary expansion of n with the distance to the next 1-bit to the right, allowing a cyclic wrap-over from the least-significant 1-bit to the most significant 1-bit. I.e. from 22 = 10110 in binary we get 20120, the 22nd term of this sequence.
a(n) = A071161(A054429(n)).

A060499 Each permutation in the list A060118 converted to Site Swap notation, with digits reversed and inverted. "Zero throws" (fixed elements) indicated with 0's.

Original entry on oeis.org

0, 11, 120, 111, 201, 222, 1300, 1313, 1120, 1111, 1201, 1223, 2020, 2011, 2330, 2312, 2222, 2231, 3001, 3023, 3131, 3122, 3302, 3333, 14000, 14014, 14140, 14113, 14203, 14244, 11300, 11314, 11120, 11111, 11201, 11224, 12020, 12011, 12340
Offset: 0

Views

Author

Antti Karttunen, Mar 22 2001

Keywords

Comments

This sequence is not well-defined for n >= 3628800 because the Site Swap notation can contain values exceeding 9, for example, the Site Swap notation for a(3628800) is [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 10]. - Sean A. Irvine, Nov 25 2022

References

Formula

a(n) = SiteSwap3ToDec(Perm2SiteSwap1(PermUnrank3L(n))).

A260743 Sequence A261220 shown in factorial base: a(n) = A007623(A261220(n)).

Original entry on oeis.org

0, 1, 10, 20, 100, 101, 200, 220, 300, 310, 1000, 1001, 1010, 1020, 2000, 2001, 2200, 2300, 3000, 3020, 3100, 3300, 4000, 4010, 4100, 4200, 10000, 10001, 10010, 10020, 10100, 10101, 10200, 10220, 10300, 10310, 20000, 20001, 20010, 20020, 22000, 22001, 23000, 23020, 24000, 24010, 30000, 30001, 30200, 30300, 31000, 31001, 33000, 33300, 34000, 34200, 40000, 40020, 40100, 40300, 41000, 41020, 42000, 42300
Offset: 0

Views

Author

Antti Karttunen, Aug 26 2015

Keywords

Crossrefs

Subsequence: A014417.

Programs

Formula

a(n) = A007623(A261220(n)).
Showing 1-10 of 10 results.