Math Is Fun Forum

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

You are not logged in.

#1 2013-02-03 23:50:09

Harold
Guest

Nth digit function

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

#2 2013-02-04 00:04:51

Bob
Administrator
Registered: 2010-06-20
Posts: 10,059

Re: Nth digit function

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
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Online

#3 2013-02-04 00:19:55

Harold
Guest

Re: Nth digit function

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.

#4 2013-02-04 00:49:59

Bob
Administrator
Registered: 2010-06-20
Posts: 10,059

Re: Nth digit function

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
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Online

#5 2013-02-04 04:42:43

Harold
Guest

Re: Nth digit function

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.)

#6 2013-02-04 04:51:12

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

Re: Nth digit function

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

#7 2013-02-04 05:02:15

Bob
Administrator
Registered: 2010-06-20
Posts: 10,059

Re: Nth digit function

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
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Online

Board footer

Powered by FluxBB