ABCD * D = DCBA (Puzzle+Solution)

April 7, 2017 § Leave a comment

The Puzzle

“ABCD * D = DCBA”, Replace every character with a number to make the equation mathematically right.

The Solution using brute-force algorithm

#include<bits/stdc++.h>
using namespace std;
int main(){
    for(int a=0;a<=9;a++){
        for(int b=0;b<=9;b++)if(a!=b){
            for(int c=0;c<=9;c++)if(a!=c && b!=c){
                for(int d=0;d<=9;d++)if(a!=d && b!=d && c!=d){
                        if((a*1000+b*100+c*10+d)*d == (d*1000+c*100+b*10+a))
                            return cout<<"abcd\n"<<a<<b<<c<<d,0;
                }
            }
        }
    }

    return 0;
}

The final answer is 1089.

Advertisements

The 6th number is both square and triangular [Puzzle]

March 28, 2017 § Leave a comment

 

Map of Mathematics By Dominic Walliman

March 18, 2017 § Leave a comment

Map of Mathematics Poster Wide

Where Am I?

You are currently browsing the math category at Orange Notes.

%d bloggers like this: