Skip to content

Minor improvement to totient() #823

@rhettinger

Description

@rhettinger

In the totient() recipe, the call to uniq_justseen() can be replaced with set().

This makes the recipe a little faster, a little shorter, and a little clearer. It eliminates the dependency on uniq_justseen(). And it eliminates the precondition that the output of factor() is ordered.

The published totient recipe uses uniq_justseen() mainly to show an application of that recipe.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions