Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**Harold****Guest**

Is ther a function that finds nth digit of a natural number(like f_2(3250)= 5) if there is how is it defined?

**bob bundy****Administrator**- Registered: 2010-06-20
- Posts: 8,082

hi Harold,

If you can describe what a function does then it exists. I understand what your function does so you have answered your own question.

But I expect you mean can I press a button and get that result. That depends on where the button is.

I don't think any calculators do this but you can certainly do it using MS Excel. You'd have to convert the integer to a string, use MID$ to extract the digit you wanted and then convert the string back to a number.

Or you could divide by the power of ten that makes your digit in the tenths place.

Use <number> - INT<number> to remove the whole numbered part.

Times by ten and use INT to remove the decimal part and you are left with the required digit.

If you are trying to do this as part of a computer program, then you'd better say what language you are using.

Bob

Children are not defined by school ...........The Fonz

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Offline

**Harold****Guest**

No, i meant is there any way to get a relation for the function,like digital root is defined as sum of digits but it's simple relation is dr(x)= x mod 9.

**bob bundy****Administrator**- Registered: 2010-06-20
- Posts: 8,082

hi Harold,

Not that I know of. Others may know.

The INT approach could be written as a formula but it wouldn't be simple.

Bob

Children are not defined by school ...........The Fonz

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Offline

**Harold****Guest**

Will f_n(x)= [10{x/10^n}] be a relation where [] is integer part and {} is fractional part?(i got the idea from your first post.)

**bobbym****bumpkin**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 109,606

Hi;

If you just want to peel digits off use this function

where n is the number and p is the position.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**** Always satisfy the Prime Directive of getting the right answer above all else.**

Offline

**bob bundy****Administrator**- Registered: 2010-06-20
- Posts: 8,082

Yes, that looks good to me. How about an extra bracket?

f_n(x)= [10{x/(10^n)}]

in case you get x/10 then raised to the power n.

Not sure if that's really needed.

Bob

Children are not defined by school ...........The Fonz

You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei

Offline

Pages: **1**