View Full Version : d(n)=?


camilus
08-28-07, 12:33 AM
Let d(n) denote the number of digits in n in its decimal representation.

So for example:

d(7) = 1

d(23) = 2

d(1987) = 4 and so on...

Can anyone find some expression that will work for any n so that when you plug in n into the formula, it will spit out how many digits it has in its decimal representation?

Absane
08-28-07, 12:35 AM
d(n) = floor[ ln(n)/ln(10) ] + 1

Pete
08-28-07, 12:44 AM
d(n) = floor[ ln(n)/ln(1) ] + 1

Spot the typo :p

To generalize:
Let d(n,b) denote the number of digits in the representation of n in base b. n and b are integers greater than zero.

d(n,b) = floor[ ln(n)/ln(b) ] + 1

It relies on a function floor(x), which denotes the largest integer less than or equal to real x.

Absane
08-28-07, 12:50 AM
Spot the typo :p

:(

Thanks.

Dividing by ln(1) would make for a bad day.

camilus
08-28-07, 01:27 PM
is there a way to type in floor(x) in a graphing calculator, or would that require mathematica or something equivalent?

Absane
08-28-07, 01:37 PM
is there a way to type in floor(x) in a graphing calculator, or would that require mathematica or something equivalent?

There should be a function in the graphing calculator... On my TI-89, it's the floor() function.

iceaura
08-28-07, 04:57 PM
is there a way to type in floor(x) in a graphing calculator, I've never seen a graphing calculator without a "greatest integer" function of some kind. Check the manual.

quadraphonics
08-28-07, 05:13 PM
People still use graphing calculators? I thought those went the way of the slide rule years ago....

iceaura
08-28-07, 09:54 PM
People still use graphing calculators? I thought those went the way of the slide rule years ago.... You see them, quite often, sitting on desks next to computers.

For people in a hurry. Computers are kind of slow, for some kinds of stuff.

And, often, on top of a pad of paper, with a pencil nearby - for extra speed.

Absane
08-28-07, 10:42 PM
People still use graphing calculators? I thought those went the way of the slide rule years ago....

I prefer my trusty TI-89 to any fancy computing.

I'm only 22. Perhaps I'll be like the old fart engineers that still insist on the slide rule.