# [✓] Get the nth element of the b-ary number?

GROUPS:
 Hi, everyone! I have used the programme pari/gp. But I cannot plot 3D graphs as easy as in programme Mathematica, so I would like to rewrite my codes into this programme language. The most important function is which gets the nth digit of a b-ary number also if it is a rational number. In the case of rational numbers I usually shift the whole number with base^50 and I floor it. The result will be shifted back by base^50. But how to get the nth element of the b-ary number? Thanks a lot! Best wishes, Kristóf
11 days ago
4 Replies
 Please post a clear example of input and desired output. Nobody likes to guess...
 Daniel Lichtblau 1 Vote Could use IntegerDigits: Bttest[nn_, base_, digit_] := IntegerDigits[nn, base, digit][[1]] In[6]:= Bttest[100, 3, 3] (* Out[6]= 2 *) This is doing no error checking though. And will require adjustment to handle noninteger input e.g. rationals.