### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook (preview only)

### Author Topic: Working with a 12 digit number?  (Read 1612 times)

#### nobodyknowsme

• Full Member
• Posts: 114
##### Working with a 12 digit number?
« on: February 03, 2015, 09:30:25 pm »
SoI want to find the prime factors of a number. It all works apart from the fact that I can't enter a number 12 digits long. Any ideas on how I would do this?

#### rvk

• Hero Member
• Posts: 3912
##### Re: Working with a 12 digit number?
« Reply #1 on: February 03, 2015, 09:34:01 pm »
The maximum of an INT64 is 9,223,372,036,854,775,807. (19 numbers) Wouldn't that be enough?

How are you inputting these values?

#### nobodyknowsme

• Full Member
• Posts: 114
##### Re: Working with a 12 digit number?
« Reply #2 on: February 03, 2015, 09:37:00 pm »
I tried Int64 and it would'nt work. Don;t think my program could handle it.

#### rvk

• Hero Member
• Posts: 3912
##### Re: Working with a 12 digit number?
« Reply #3 on: February 03, 2015, 09:40:05 pm »
That's why I asked how you where inputting these numbers.
Int64 works perfectly for these high numbers.

(inputting 123456789012345 gives 123456789012345 back)
Code: [Select]
`program Project1;var  i: int64;begin  readln(i);  writeln(i);  readln;end.`
So I guess you need to change your program to handle int64 correctly.

#### nobodyknowsme

• Full Member
• Posts: 114
##### Re: Working with a 12 digit number?
« Reply #4 on: February 03, 2015, 09:59:44 pm »
Oh yeah, thank you very much. I now have the prime factors of  600851475143 lol