Is there an easy way to determine how many factors a number has?


My student wanted to know. The classic way is to do the prime factorization for the number, take the exponent of each prime factor and add 1 to it and multiply these together, and the result is the number of factors that the original number has.

The 17b can do it easily in a solver equation:


It works on the 17b, 17bii, and 17bii+, although it's much slower on the plus.

Edited: 2 July 2011, 9:45 p.m.


I'm not aware of any and I believe that finding this is equivalent in difficult to factorising. I looked at adding this to the 34s firmware but didn't dig too deeply.

Once you have the prime factorisation, determining the factors is straightforward as you've pointed out.

- Pauli


Otherwise there would be a an easy way to tell whether a number is prime or not. There are a number of interesting properties related to this, however. One of them states that perfect squares, and only them, have an odd number of divisors (more at OEIS). This is the basis for the optimized solution to the 100 doors problem (the following wp34s program will display the doors that will be open after the last pass).

001 LBL D
002 2
003 10^x
004 SQRT
005 FP?
006 SKIP 02
007 RCL L
008 PSE 10
009 DEC L
010 x<> L
011 x>1?
012 BACK 08
013 RTN


Gerson, wouldn't it be much easier to just compute the squares from 1^2 to 10^2 instead of testing each integer if it is a square?


Yes, it would :-) And it would make for an extremely short wp34s program.

BTW at least a couple of optimized C solutions there follow that approach:

#include <stdio.h>

int main()
int i;
for (i = 1; i * i <= 100; i++)
printf("door %d open\n", i * i);

return 0;

#include <iostream> //compiled with "Dev-C++" , from RaptorOne

int main()
for(int i=1; i*i<=100; i++)
std::cout<<"Door "<<i*i<<" is open!"<<std::endl;

A mathematical explanation, in Spanish:

Edited: 3 July 2011, 2:36 p.m.


at last an explanation I can understand :-)


lol... in RPL could be

"door " { 1 2 3 4 5 6 7 8 9 10 } SQ ADD " is open" ADD MSGBOX


On the 50G it's very easy, but it's a little cheating ;)


Possibly Related Threads...
Thread Author Replies Views Last Post
  [WP 34s] Pressure Conversion Factors Timothy Roche 8 1,303 11-04-2013, 07:17 PM
Last Post: Dave Shaffer (Arizona)
  An easy course in using the HP16c-wanted- Frank 4 865 10-29-2013, 11:50 AM
Last Post: Mark Hardman
  OT: Jeppesen E6B Wind-Easy Computer (Slide Rule) Eddie W. Shore 18 2,768 10-12-2013, 03:26 PM
Last Post: George Litauszky
  HP Prime: Conversion factors Paul Townsend (UK) 19 1,969 08-27-2013, 09:19 AM
Last Post: Nigel J Dowrick
  HP-15C LE Bad Button >>> easy fix Reth 1 454 11-24-2011, 06:21 PM
Last Post: Raymond Del Tondo
  MySamba and Linux: (easy) success! Cristian Arezzini 3 556 10-27-2011, 09:05 AM
Last Post: Egan Ford
  Finding prime factors on a "non-programmable" calculator Don Shepherd 6 871 09-05-2011, 10:11 AM
Last Post: Allen
  Thanks for a simple, easy to use forum Bill (Smithville, NJ) 20 1,818 08-29-2011, 04:34 PM
Last Post: Marcus von Cube, Germany
  A suggestion for easy improvement of the HP17bII+ Jose Gonzalez Divasson 1 383 07-10-2011, 10:38 AM
Last Post: Tim Wessman
  The Prime Factors Kata Thomas Klemm 2 420 06-27-2011, 03:32 PM
Last Post: Thomas Klemm

Forum Jump: