- 愛因斯坦曾經提出過這樣一道有趣的數學題:有一個長階梯,若每步上2階,最后剩下1階;若每步上3階,最后剩2階;若每步上5階,最后剩下4階;若每步上6階,最后剩5階;只有每步上7階,最后剛好一階也不剩。請問該階梯至少有多少階。
1 package com.baidu.demo; 2 3 public class Demo02 { 4 5 public static void main(String[] args) { 6 for (int i = 0;; i++) { 7 if (i%2 == 1 && i%3 == 2 && i%4 == 3 && i%5 == 4 && i%6 == 5 && i%7==0 ) { 8 System.out.println(i); 9 } 10 } 11 } 12 }