My Math Forum  

Go Back   My Math Forum > College Math Forum > Applied Math

Applied Math Applied Math Forum


Reply
 
LinkBack Thread Tools Display Modes
January 29th, 2012, 05:16 PM   #1
Member
 
Joined: Jan 2012

Posts: 40
Thanks: 0

converting multiples

Say you have a group of equations like 5*7 and 11*31. Each of theses equations are -1 and +1 respectivly away from a multiple of 6. When multiplied they will always be equal to a number of the form 6n-1. Say I wanted to find out what times 6 equals the 6n part of that. So for instance 5*7=35, 6*6=36; 11*31=341 6*57=342.What I have discovered from playing around with the numbers is any time the multiples are two away from each other like 5*7 or 11*13 just converting to the nearest multiple of 6 is enough. For the case of 11*13 we would make them 12*12 and if I want that in 6n form I would divide by two and multiply by two to make 6*24. That stuff is preety easy and if there is a better way to do what I just did let me know so I dont have to divide and multiply. The real reason I opened this topic is for the other numbers. 11*31 for instance. If I take 11*31 and turn it into 12*30 then divide the 12 by 2 to get 6 and multiply the 30 by 2 to get 60 then subtract 12 from 30 to get 18 then divide 18 by 6 to get 3 and subtract 3 from 60 to get 57 I end up with 6*57=342. Hope I wasnt confusing just now. I am wondering if there is a more efficent method assuming that I do not want to calculate the orginal equation and add 1 then divide by 6. The reason that I do not want to solve the equations first is there are some large numbers to deal with and I only want the 6n conversion anyways.
Tylerman is offline  
 
January 29th, 2012, 05:49 PM   #2
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: converting multiples

I recommend using a computer if the numbers are too large to work with directly. PARI/GP, in my .sig below, is a good choice for this kind of work; to solve this particular problm you can type (for example)
Code:
378782785241*3275342785\/6
where the first part is the number and the "\/6" gives you the n such that the number is 6n+1 or 6n-1, if such an n exists.
CRGreathouse is offline  
January 30th, 2012, 10:31 AM   #3
Member
 
Joined: Jan 2012

Posts: 40
Thanks: 0

Re: converting multiples

This program really kicks. What does it mean after it produces a number and at the end it has [+++]?
Tylerman is offline  
January 30th, 2012, 10:34 AM   #4
Member
 
Joined: Jan 2012

Posts: 40
Thanks: 0

Re: converting multiples

Also can it read from txt documents? Like if I had two really large numbers in two txt documents would it be able to read the numbers from the txt documents? If thats possible can it save results to a txt document? Im going to be going over the faq to try to find the awnsers. Thanks for the help.
Tylerman is offline  
January 30th, 2012, 01:15 PM   #5
Global Moderator
 
CRGreathouse's Avatar
 
Joined: Nov 2006
From: UTC -5

Posts: 16,046
Thanks: 938

Math Focus: Number theory, computational mathematics, combinatorics, FOM, symbolic logic, TCS, algorithms
Re: converting multiples

Quote:
Originally Posted by Tylerman
This program really kicks. What does it mean after it produces a number and at the end it has [+++]?
I'm not sure, can you give some context?

Quote:
Originally Posted by Tylerman
Also can it read from txt documents? Like if I had two really large numbers in two txt documents would it be able to read the numbers from the txt documents? If thats possible can it save results to a txt document? Im going to be going over the faq to try to find the awnsers. Thanks for the help.
Yes. Just type read("filename.txt") and it will parse the entire file. If you have several numbers in a file you can either name them in the file
Code:
num1 = 12.3;
num2 = 10.11;
piApprox = 3.1416;
or you can use readvec to store each in a vector.

You can write to files with the write and write1 commands (the former appends a newline, the latter does not).
CRGreathouse is offline  
Reply

  My Math Forum > College Math Forum > Applied Math

Tags
converting, multiples



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Common multiples of two numbers md9 Abstract Algebra 1 May 10th, 2013 01:26 PM
multiples nitin1 Number Theory 11 December 14th, 2012 09:59 AM
why is my function so stable at multiples of 22? mark212 Algebra 5 April 10th, 2012 09:06 PM
multiples of 2 pi Icevox Number Theory 8 March 25th, 2011 01:11 PM
Converting y=kx^n --> y=mx + B haroldtreen Physics 3 November 13th, 2009 12:19 AM





Copyright © 2018 My Math Forum. All rights reserved.