# How to find prime factors of a number in R?

R ProgrammingServer Side ProgrammingProgramming

#### Artificial Intelligence : The Future Of Programming

15 Lectures 54 mins

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### C Programming from scratch- Master C Programming

Best Seller

60 Lectures 8 hours

A prime number is the number that is only divisible by itself and one. These prime numbers can also divide other numbers hence they become a factor of those numbers. For example, 5 is a prime number and it also divides 20. To find the prime factors of a number, we can use primeFactors function of numbers package.

## Examples

library(numbers)

primeFactors(100)

[1] 2 2 5 5

primeFactors(1000)

[1] 2 2 2 5 5 5


primeFactors(32547)

[1] 3 19 571

primeFactors(12354767)

[1] 17 726751


primeFactors(21457)

[1] 43 499

primeFactors(99)

[1] 3 3 11


primeFactors(365748)

[1] 2 2 3 29 1051

primeFactors(214687)

[1] 11 29 673


primeFactors(3587497)

[1] 3587497

primeFactors(35874)

[1] 2 3 3 1993


primeFactors(268713)

[1] 3 3 73 409

primeFactors(298473)

[1] 3 7 61 233


primeFactors(236571)

[1] 3 78857

primeFactors(98753)

[1] 17 37 157


primeFactors(547821)

[1] 3 3 60869

primeFactors(3652147)

[1] 23 97 1637


primeFactors(6985147)

[1] 13 17 31607

primeFactors(1236587469)

[1] 3 13 19 131 12739


primeFactors(65214693)

[1] 3 3 3 2415359

primeFactors(326579)

[1] 11 11 2699


primeFactors(1236574)

[1] 2 618287

primeFactors(1500)

[1] 2 2 3 5 5 5


primeFactors(1521)

[1] 3 3 13 13

primeFactors(36254761235)

[1] 5 7 11 113 833347


primeFactors(25896321)

[1] 3 3 3 11 17 23 223

primeFactors(25821469)

[1] 25821469


primeFactors(36952147)

[1] 2447 15101

primeFactors(23621576)

[1] 2 2 2 11 41 6547


primeFactors(6985314)

[1] 2 3 3 7 55439

primeFactors(87452)

[1] 2 2 21863


primeFactors(326987125)

[1] 5 5 5 2615897

primeFactors(36582314)

[1] 2 18291157


primeFactors(96325741)

[1] 131 735311

primeFactors(121)

[1] 11 11


primeFactors(109)

[1] 109

primeFactors(136)

[1] 2 2 2 17


primeFactors(136672)

[1] 2 2 2 2 2 4271

primeFactors(137)

[1] 137


primeFactors(368742)

[1] 2 3 11 37 151

primeFactors(36)

[1] 2 2 3 3


primeFactors(49)

[1] 7 7

primeFactors(80)

[1] 2 2 2 2 5


primeFactors(23687111)

[1] 7 1297 2609

primeFactors(11111)

[1] 41 271


primeFactors(22222222)

[1] 2 11 73 101 137
Updated on 06-Mar-2021 13:07:03