[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Everybody loves math

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 8
Thread images: 4

File: index.jpg (8KB, 318x159px) Image search: [Google]
index.jpg
8KB, 318x159px
Please tell me an efficient and easy way to calculate the values c & d.

0 <= c,d <= 25

9 = (c * 2 + d) % 26
14 = (c * 17 + d) % 26
>>
File: numerically.png (9KB, 741x106px) Image search: [Google]
numerically.png
9KB, 741x106px
>>352234
Numerically.

Generally, if there's fewer than a few billion permutations, there's no point in being cute.

https://repl.it/Jfth/0
>>
File: code.png (8KB, 372x276px) Image search: [Google]
code.png
8KB, 372x276px
>>352244
I had the same idea, but I also need to calculate the values with pen & paper. Isn't there a different approach than just testing each value?
>>
>>352247
You're breaking out constants for no reason there.

Read http://thedailywtf.com/articles/Soft_Coding .

Maybe also read up on the "and" operator and using the "%" operator on formatting strings.
>>
>>352247
You can subtract top from bottom to get

5 = (15c) % 26

Then find a number x so that x*15 = 1 %26. Just keep looking at multiples of 26 until you get one where number+1 is divisible by 15. We know this is only possible for multiples of 4 - 4 works actually. 26*4 + 1 = 105, which divides by 15 into 7. So then we can do

5*7 = 15c*7 %26

Mod of the lefthand side is 9. Now you can plug in c to get d.
>>
>>352276
Seems good.
Thank you, anon.
>>
>>352234
Numerator=Quotient*Denominator+Remainder
Since it's an integer division, I'll name the quotients "n" and "m"
9 = (c * 2 + d) % 26 <=> c * 2 + d = n*26 + 9
14 = (c * 17 + d) % 26 <=> c * 17 + d = m*26 + 14
c = 1/3 + 26*m/15 - 26*n/15
d = 25/3 - 52*m/15 + 442*n/15
c >= 0 <=> n <= m + 5/26
c <= 25 <=> n >= 1/13 (13 * m - 185)
d >= 0 <=> n >= 1/442 * (52 * m - 125)
d <= 25 <=> n <= 1/221 (26 * m + 125)
These can be solved grafically. You get many (n, m) couples that solve your equations. If you want integer c and d, the (1, 6) couple results in c = 9 and d = 17.
>>
File: 1500052714279.jpg (182KB, 800x999px) Image search: [Google]
1500052714279.jpg
182KB, 800x999px
>>352373
Thank you for your detailed answer.
Thread posts: 8
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.