CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 06:24:51 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=8e726b99e8d27c4fa1c956bd136c6d98c7db01c7c0d3e414ccb827801e549439a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22pWJLmRiCsimhbjWaXcbhWRjJMQRCwTNe%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d484409ba2860e-BLR
PARI sourcecode for demo in A055881 - Pastebin.com
SHARE
TWEET

PARI sourcecode for demo in A055881
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This demonstrative program should be used for either documentation or instructive purposes only,
- and goes without any warranty whatsoever.
- This is part of: The On-Line Encyclopedia Of Integer Sequences OEIS(TM)
- Visit: http://www.oeis.org/A055881
- Author: Joerg Arndt (www.jjj.de), Dec 12 2012
- Pastebin by: R. J. Cano (remy@ula.ve), Dec 17 2012
- perm(n)=
- /* Compute the first n! terms of A055881 by counting
- in rising factorial base.
- Generate all permutations of n along the way.
- */
- {
- my( fc=vector(n) ); /* mixed radix numbers (rising factorial base) */
- my( ct=0, j, a=0 );
- my( p=vector(n,k,k-1) ); /* permutation */
- my( k, t ); /* for permutations */
- while ( 1,
- print1(ct, ": ", p); /* permutation */
- print1(" ", a ); /* A055881(ct): position of rightmost change in fc[] */
- print1(" ", fc); /* factorial number */
- print();
- ct += 1;
- /* increment factorial number fc[]: */
- j = 1;
- while ( fc[j] == j, fc[j]=0; j+=1; ); /* scan over nines */
- if ( j==n, return() ); /* current is last */
- fc[j] += 1;
- /* update permutation p[], reverse prefix of length j+1: */
- a = j; /* next term of A055881 */
- j += 1; k = 1;
- while ( k < j,
- t=p[j]; p[j]=p[k]; p[k]=t;
- k+=1; j-=1;
- );
- );
- }
- print("Demonstration: Reproduces the example given in the comments section for A055881");
- perm(4);
- print(" ");
- print("You are free to call perm() and experiment with it. When finished, type \"quit\" to exit.");
- print(" ");
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ Y
JavaScript | 2 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ A
JavaScript | 13 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ O
JavaScript | 17 sec ago | 0.25 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ L
JavaScript | 24 sec ago | 0.25 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ 9
JavaScript | 26 sec ago | 0.25 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ H
JavaScript | 33 sec ago | 0.25 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ D
JavaScript | 35 sec ago | 0.25 KB
-
📌 Swapzone +37% glitch ⭐ 5
JavaScript | 41 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand