Writing a program to display numbers that are the same in reverse. For example 22, 232, 9009, 1221, etc

Writing a program to display numbers that are the same in reverse. For example 22, 232, 9009, 1221, etc

Can anyone write the equations for 6 digits+ up until you don't understand the pattern anymore. I'm too stupid/tired to see it right now.

For 2 digit numbers
f(x) = (10)(x % 10) + (x - (x % 10)) / 10

For 3 digit numbers
f(x) = (100)(x % 10) + ((x - (x % 10)) % 100) + (x - (x % 100)) / 100

For 4 digit numbers
f(x) = (1000)(x % 10) + ((x - (x % 10)) % 100) * 10 + ((x - (x % 100)) % 1000) / 10 + (x - (x % 1000)) / 1000

For 5 digit numbers
f(x) = (10000)(x % 10) + ((x - (x % 10)) % 100) * 100 + ((x - (x % 100)) % 1000) + ((x - (x % 1000)) % 10000) / 100 + (x - (x % 10000)) / 10000

TLDR; give me the equation for 6 digits and on, for math

Other urls found in this thread:

en.wikipedia.org/wiki/Palindrome
twitter.com/AnonBabble

>Writing a program to display numbers that are the same in reverse
we should have a name for this kind of thing!

Palindrome numbers

en.wikipedia.org/wiki/Palindrome

2. the only shape that doesn't have anything wrong with it

It's the most normal, that's something wrong with it? lol

yes, its the most normal, so its the oddest one

5th one because it is a circle as well as smaller than 3 out of the five. All of the other shapes only differ in one feature except for the circle.

It's 3 Stupid

I'm convinced there is no right answer

user, you only need one formula for odd lengths and one for even lengths, and they're almost the same. Look up 0-1-infinity principle. Bonus if you do it recursively.

They are all heteroclites in their own regard, no two are the same.

it's 4

Crap. Thanks I'll try that

why be such a smartfag user?
for(int i=0; i

You are responding to the right answer.

op, you're doing this stupidly
convert the number to a string, write a loop to see if it's a palindrome.

I just went full retard :(

Why do you even want to write it like that? Just take an input n and return nn' where n' is n with the digits reversed.

Why would you waste time checking every number? It is easy to generate them in order.

It's 2. Think oc it this way, all the other shapes have already one trait that none of the other share.. 2 has nothing exclusive to it, so it's different from the rest

2. All of its attributes are shared by others in the set. There are other reds, other squares, other outlined shapes, and others of that size. Unlike the rest it has nothing that sets it apart from the others in the set.

But them 2 does have something that sets it apart... this is a self reference paradox.

Nah, just limit your comparisons to first-order properties, not second-order or above.

everybody but you knows it's 2

But that feels almost as arbitrary as deciding that size or color is the distinguishing attribute. It is not satisfying.

Fuck numbers. Just do it with strings.

Yep just got it using strings. I'm a retard. Thanks everyone

Nah, it still makes sense.
First-order properties of these elements
>Size
>Shape
>Color
>Border
I would do a matrix here, but the for setting would be atrocious on Sup Forums, so instead I'll just point out that each element shares 2 of the 4 properties with any other element, except #2, which shares 3 with each other.

>Remove #2 from the set
>Each remaining element shares 2 of 4 first-order properties with the others

For any other element, it's removal leaves an inconsistent set, with varying number of similarities between elements.

Even though I'd say the answer is 2, I consider that "problem" flawed. If we consider "different size" to be number 1's unique characteristic then it is, in fact, not unique, since the circle also possesses different dimensions from the other squares (the circle is evidently the same height as the squares, therefore has a smaller total area and could technically be inscribed on top of them)

Won't get a Google job with a String answer. It's less memory efficient. You can do it with integers.

this is the odd 1 out

The green one duh lol

6. It's number is white, it's colored white and the shape is unlike any of the others.

This is what SJW's want you to believe about white males.

Human time and code readability is more valuable than machine time. Google is really going downhill if they have forgotten this.

1) So it IS faster to do this with ints than strings? I have it done with strings for any number put ints only up to 5 digits long

2) check image

...