Created
December 17, 2018 10:08
-
-
Save stelf/70220c848b04fb94d2f77fe37cd1552e to your computer and use it in GitHub Desktop.
find dates with 11/22/33 vibration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for (let y = 2000; y <= 2099; y++ ) { | |
| let [ y11, y22, y33 ] = [0,0,0]; | |
| for (let m = 1; m <= 12; m++ ) { | |
| for (let d = 1; d < 31; d++ ) { | |
| let yx = parseInt(y / 1000) + parseInt((y % 100) / 10 ) + y % 10; | |
| if (yx != 11 && yx != 22 && yx != 33 ) { | |
| while (yx >= 10) | |
| yx = parseInt(yx / 10) + yx % 10; | |
| } | |
| if ( d != 22 && d != 11) { | |
| sx = (d % 10) + parseInt(d / 10) | |
| } else { | |
| sx = d; | |
| } | |
| if ( m == 11 ) { | |
| sx += 11; | |
| } else { | |
| sx += parseInt(m / 10) + m % 10; | |
| } | |
| // if (sx >= 10 ) { | |
| // if ((sx != 11) && (sx != 22)) { | |
| // sx = (sx % 10) + parseInt(sx / 10) | |
| // } | |
| // } | |
| sum = sx + yx; | |
| if (sum == 11) { | |
| y11++; | |
| console.log(`11 : ${d} ${m} ${y}`) | |
| } | |
| if (sum == 22) { | |
| y22++; | |
| console.log(`22 : ${d} ${m} ${y}`) | |
| } | |
| if (sum == 33) { | |
| y33++; | |
| console.log(`33 : ${d} ${m} ${y}`) | |
| } | |
| } | |
| } | |
| console.log(`${y} : 11 -> ${y11} || 22 -> ${y22} | 33 -> ${y33} `) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment