| | |
A challenge for all newbies
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
![]() |
Find a six digit number that gives its digits reversed when multiplied by an integer between 2 and 9 inclusive. For example, if the original number was 654321 and the chosen integer was 8, then 654321 x 8 should equal 123456 if it was the magic number (which of course it doesnt). There are two (2) solutions.
Lets see who is the first to find out the exact numbers .... you can make a small program or you can do it MANUALLY :mrgreen: :evil:
Lets see who is the first to find out the exact numbers .... you can make a small program or you can do it MANUALLY :mrgreen: :evil:
Nothing too fancy...
import java.io.*;
import java.awt.*;
import java.util.*;
public class NumberFinder {
int test;
int newNumber;
public static void main(String[] args) {
NumberFinder go = new NumberFinder();
}
public NumberFinder() {
launch();
}
public void launch() {
System.out.println("Starting to run");
for(int i=100000; i<=999999; i++){
for(int j=2; j<=9; j++){
newNumber=reverse(i);
if(i*j==newNumber){
System.out.println("The number is "+i+" and the multiplier is "+j);
}
}
}
}
public int reverse(int x){
String test = String.valueOf(x);
String done = "";
int run =5;
int sendBack;
while(run!=-1){
done = done+test.charAt(run);
run--;
}
sendBack = Integer.parseInt(done);
return sendBack;
}
} nice work ... I first reversed the number by modulus .. and then started off from 499999 .... in this way the processor had to do half the work
. Your idea of reversing the number is also good.
. Your idea of reversing the number is also good. •
•
Join Date: Nov 2004
Posts: 3
Reputation:
Solved Threads: 0
0
#8 Nov 26th, 2004
[QUOTE=nanosani]Find a six digit number that gives its digits reversed when multiplied by an integer between 2 and 9 inclusive. For example, if the original number was 654321 and the chosen integer was 8, then 654321 x 8 should equal 123456 if it was the magic number (which of course it doesnt). There are two (2) solutions.
Lets see who is the first to find out the exact numbers .... you can make a small program or you can do it MANUALLY :mrgreen: :evil:[/QU1234567890
Lets see who is the first to find out the exact numbers .... you can make a small program or you can do it MANUALLY :mrgreen: :evil:[/QU1234567890
•
•
Join Date: Nov 2004
Posts: 3
Reputation:
Solved Threads: 0
[QUOTE=kirkchildress] 1234567890
•
•
•
•
Originally Posted by nanosani
Find a six digit number that gives its digits reversed when multiplied by an integer between 2 and 9 inclusive. For example, if the original number was 654321 and the chosen integer was 8, then 654321 x 8 should equal 123456 if it was the magic number (which of course it doesnt). There are two (2) solutions.
Lets see who is the first to find out the exact numbers .... you can make a small program or you can do it MANUALLY :mrgreen: :evil:
![]() |
Other Threads in the Computer Science Forum
- Previous Thread: Pls...click me
- Next Thread: concurrent service
Views: 8364 | Replies: 29
| Thread Tools | Search this Thread |
Tag cloud for Computer Science
ai algorithm algorithms amazon assignment assignmenthelp assignments battery bigbrother binary bittorrent blogging bomb business cern clueless codebreaker compiler computer computers computerscience computertrackingsoftware conversion csc data dataanalysis dataintepretation development dfa dissertation dissertations dissertationtopic ebook employment energy extensions floatingpoint foreclosure foreclosuresoftware fuel gadgets geeks givemetehcodez government hardware homeowners homework homeworkassignment homeworkhelp ibm ideas internet iphone ipod itcontracts jobs kindle laser laws lazy linkbait mainframes marketing mobileapplication msaccess nano netbeans networking news os p2p parser piracy piratebay programming rasterizer research sam-being-cute sas science security sex simulation software spoonfeeding spying sql stephenfry student study supercomputer supercomputing syntactic technology textfield tree two'scompliment uk virus ww2






