My Math Forum reverse n

 Number Theory Number Theory Math Forum

October 20th, 2011, 10:35 AM   #11
Global Moderator

Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: reverse n

Quote:
 Originally Posted by vdrn generalized expression of what comes after f(n)=
Isn't that what I just wrote? If not, explain what you mean by "generalized" and "expression".

 October 20th, 2011, 10:40 AM #12 Newbie   Joined: Oct 2011 Posts: 15 Thanks: 0 Re: reverse n Is there a formula for reversing n?
 October 20th, 2011, 01:07 PM #13 Math Team   Joined: Apr 2010 Posts: 2,780 Thanks: 361 Re: reverse n If you want a formula, a test for a palindrome is something like this: Let m+1 be the amount of digits of your number $a_k \in \{0,1,2,...,9\}\;\;n=\sum_{k=0}^{m}a_k \cdot 10^k$ $\lfloor x\rfloor$ is the floorfunction $|x|$ returns the absolute value of x Evaluate $\sum_{k=0}^{\lfloor\frac{m}{2}\rfloor}\left|a_k-a_{m-k}\right|$ If it is 0, the number is palindrome, else not.
October 20th, 2011, 02:22 PM   #14
Newbie

Joined: Oct 2011

Posts: 15
Thanks: 0

Re: reverse n

Quote:
 Originally Posted by Hoempa If you want a formula, a test for a palindrome is something like this: Let m+1 be the amount of digits of your number $a_k \in \{0,1,2,...,9\}\;\;n=\sum_{k=0}^{m}a_k \cdot 10^k$ $\lfloor x\rfloor$ is the floorfunction $|x|$ returns the absolute value of x Evaluate $\sum_{k=0}^{\lfloor\frac{m}{2}\rfloor}\left|a_k-a_{m-k}\right|$ If it is 0, the number is palindrome, else not.
There are many ways test it. I was just putting things into some context with mentioning palindromic numbers. The real issue for me is how to reverse n.

October 20th, 2011, 02:42 PM   #15
Math Team

Joined: Apr 2010

Posts: 2,780
Thanks: 361

Re: reverse n

Quote:
 Originally Posted by vdrn I was looking for a way to test if some, non-negative, integer n is a palindrome.
O, I'm sorry. I thought you where looking for a way to test if some, non-negative, integer n is a palindrome. And reversing the digits was to be a method to do so.

October 20th, 2011, 03:22 PM   #16
Newbie

Joined: Oct 2011

Posts: 15
Thanks: 0

Re: reverse n

Quote:
Originally Posted by Hoempa
Quote:
 Originally Posted by vdrn I was looking for a way to test if some, non-negative, integer n is a palindrome.
O, I'm sorry. I thought you where looking for a way to test if some, non-negative, integer n is a palindrome. And reversing the digits was to be a method to do so.
"I was looking"...until I got interested in how would a formula for reversing n (part of testing n method) with the described properties look like.

 October 20th, 2011, 05:08 PM #17 Global Moderator     Joined: Nov 2006 From: UTC -5 Posts: 16,046 Thanks: 938 Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms Re: reverse n What, then, do you mean by "formula"? Not function, because I gave a function and it wasn't what you wanted. Not polynomial -- there is no such polynomial.
 October 20th, 2011, 05:22 PM #18 Newbie   Joined: Oct 2011 Posts: 15 Thanks: 0 Re: reverse n How would you calculate the reverse of n then?
 October 21st, 2011, 01:10 AM #19 Senior Member   Joined: May 2008 From: York, UK Posts: 1,300 Thanks: 0 Re: reverse n To reverse a positive integer, you need to know what its base 10 representation is, and to do so you need to work out each digit of the integer $n$ in base 10. We can write down a formula for each digit: $a_k\equiv\lfloor 10^{-k}n\rfloor\ (\text{mod }10)$ where $a_k\in\mathbb{Z}_{10}$ is the coefficient of $10^k$ in the decimal expansion of $n.$ There is always a largest non-zero $k,$ which we will denote $K.$ The reverse of $n$ is given by $r(n)=\sum_{k=0}^Ka_k10^{K-k}.$ There is no 'neater' way of doing this.
October 21st, 2011, 05:59 AM   #20
Newbie

Joined: Oct 2011

Posts: 15
Thanks: 0

Re: reverse n

Quote:
 Originally Posted by mattpi To reverse a positive integer, you need to know what its base 10 representation is, and to do so you need to work out each digit of the integer $n$ in base 10. We can write down a formula for each digit: $a_k\equiv\lfloor 10^{-k}n\rfloor\ (\text{mod }10)$ where $a_k\in\mathbb{Z}_{10}$ is the coefficient of $10^k$ in the decimal expansion of $n.$ There is always a largest non-zero $k,$ which we will denote $K.$ The reverse of $n$ is given by $r(n)=\sum_{k=0}^Ka_k10^{K-k}.$ There is no 'neater' way of doing this.
Thanks! Do you know the source of this formula?

 Tags reverse

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post zuba Applied Math 1 December 19th, 2012 02:58 AM ravynware Algebra 0 April 15th, 2012 07:11 PM swtrse Number Theory 2 August 6th, 2009 04:53 AM NumberA Algebra 5 April 19th, 2009 11:03 AM Clox Algebra 2 January 23rd, 2008 12:24 AM

 Contact - Home - Forums - Cryptocurrency Forum - Top