Sunday, April 3, 2011

Number Magic

Thanks to a post from one of my old manager, mentor and friend - Anand Mohanram - 10 (Square + Cube pattern - Interesting Number Pattern), I was able to find an interesting pattern. Some were commented to his facebook posts.
1. The difference between the cube numbers over their previous square partners is an arithmetic progression with common difference of 1. See them below:
2+1=3
3+3=6
4+6=10
5+10=15
6+15=21
7+21=28
8+28=36
9+36=45
10+45=55
11+55=66
12+66=78
13+78=91
14+91=105
15+105=120
16+120=136
17+136=153
18+153=171
19+171=190
20+190=210
21+210=231
22+231=253
23+253=276
24+276=300
25+300=325
26+325=351
27+351=378
28+378=406
29+406=435
30+435=465
31+465=496
32+496=528
33+528=561
34+561=595
35+595=630
36+630=666
37+666=703
38+703=741
39+741=780
40+780=820
41+820=861
42+861=903
43+903=946
44+946=990
45+990=1035

Actually, we can easily find the numbers matching the pattern by solving the equation:
a^3+b^2 = (a+b)^2;
=>a^3+b^2 = a^2+b^2+2*a*b;
=>b = a*(a-1)/2


This explains the AP of constant 1 between the numbers for every value of a.


Java Source code that helped to find this (though its of no use now) :




public void findSquareCubeNumbers(int count){
for (int i = 1; i < count; i++){
int num = i*i*i;
for (int j = 1; j < count; j++){
int sum = i+j;
if (num+(j*j)==sum*sum){
System.out.println(i+"+"+j+"="+sum);
}
}
}
}

2. For any number n from 1 to 10 and any number k that satisfy the condition - k^n + k^(n+1) = (k+k)^n
the next such condition is satisfied by (2k+1).
The below illustration is the proof:
(k= 1((2*0)+1); n= 1) 1^1+1^2=2^1
(k= 3((2*1)+1); n= 2) 3^2+3^3=6^2
(k= 7((2*3)+1); n= 3) 7^3+7^4=14^3
(k= 15((2*7)+1); n= 4) 15^4+15^5=30^4
(k= 31((2*15)+1); n= 5) 31^5+31^6=62^5
(k= 63((2*31)+1); n= 6) 63^6+63^7=126^6
(k= 127((2*63)+1); n= 7) 127^7+127^8=254^7
(k= 255((2*127)+1); n= 8) 255^8+255^9=510^8
(k= 511((2*255)+1); n= 9) 511^9+511^10=1022^9
(k= 1023((2*511)+1); n= 10) 1023^10+1023^11=2046^10

Java Source code that helped to find this:


public void findNextPowerNumbers(int powVal, int count){
double prevK = 0;
for(double i = 1; i < powVal; i++){
double power = i+1;
for (double k = 1; k < count; k++){
double num = Math.pow(k, power);
double num1 = Math.pow(k, i);
double sum = 2*k;
double num3 = Math.pow(sum, i);
if (num+num1 == num3){
System.out.println("(k= "+k+"((2*"+prevK+")+1); n= "+i+") "+k+"^"+i+"+"+k+"^"+power+"="+sum+"^"+i);
prevK=k;
}
}
}
}

No comments: