Thursday, September 4, 2025
HomeLanguagesSymPy | Prufer.unrank() in Python

SymPy | Prufer.unrank() in Python

Prufer.unrank() : unrank() is a sympy Python library function that returns the unranked Prufer sequence.

Syntax :
sympy.combinatorics.Prufer.prufer.unrank()

Return :
unranked Prufer sequence

Code #1 : unrank() Example




# Python code explaining
# SymPy.Prufer.unrank()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.prufer import Prufer
  
# Using from 
# sympy.combinatorics.prufer.Prufer.unrank()
  
# Creating Prufer
a = Prufer([1, 2, 3], [2, 4, 5])
  
# unrank value
# rank = 2
# n = 5
print ("Prufer a unrank : ", a.unrank(2, 5))


Output :

Prufer a unrank : 125

Code #2 : unrank() Example




# Python code explaining
# SymPy.Prufer.unrank()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.prufer import Prufer
  
# Using from 
# sympy.combinatorics.prufer.Prufer.unrank()
  
# Creating Prufer
b = Prufer([1, 2, 3, 2, 4, 5], [6, 7], [8])
  
# unrank value
# rank = 2
# n = 5
print ("Prufer b unrank : ", b.unrank(2, 5))


Output :

Prufer b unrank : Prufer([0, 0, 2])

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS