# Strings with given frequency

Is there a sage function that gives me all vectors/strings/lists/tuples of integers with given "absolute frequency"? i.e.

dwim([2, 1]) == ["001", "010", "100"]

Strings with given frequency

asked **
2014-02-04 10:52:06 -0600
**

Anonymous

Is there a sage function that gives me all vectors/strings/lists/tuples of integers with given "absolute frequency"? i.e.

dwim([2, 1]) == ["001", "010", "100"]

add a comment

2

What you want is probably `Permutations`

```
sage: P = Permutations([0]*2+[1])
sage: P.list()
[[0, 0, 1], [0, 1, 0], [1, 0, 0]]
```

1

Asked: **
2014-02-04 10:52:06 -0600
**

Seen: **84 times**

Last updated: **Feb 04 '14**

A Combinatorics Problem - Product Rule Indices

DyckWords: workaround for from_ordered_tree?

Seeking an efficient filter for partitions.

Forming a polytope from only its combinatorial data

optimizing graph coloring for small chromatic number

code for tail and head of an edge in a bipartite graph

All decompositions of a prime as a sum of four squares

Can I create these sequences with Sage?

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.