순서:
- 우리는에서 시작
1
합니다. - 먼저 현재 1 인덱스 값을 시퀀스의 이전 숫자에 추가합니다.
- 그런 다음이 현재 값에 적용되는 경우 다음 수학 연산을 순서대로 적용합니다.
- 로 나눌 수
2
있습니까? => 추가 - 로 나눌 수 있음
3
있습니까? => 빼기 - 로 나눌 수
4
있습니까? => (더하기 AND) 곱하기 - 안도로 나누어
2
,3
도4
? -> 현재 합계 결과 계속
- 로 나눌 수
산출:
이 순서로 처음 100 개의 숫자를 출력하십시오.
1, 1, 21, 25, 30, 216, 223, 223, 2169, 2179, 2190, 2202, 2215, 2215, 2245, 2261, 2295, 2295, 2333, 2353, 2395, 2417, 56649, 56649, 56699, 56725, 1533033, 1533061, 1533090, 45993600, 45993631, 45993631, 1517792001, 1517792035, 1517792070, 1517792106, 1517792143, 1517792143, 1517792221, 1517792261, 1517792343, 1517792343, 1517792429, 1517792473, 1517792563, 1517792609, 71336257041, 71336257041, 71336257139, 71336257189, 3638149121841, 3638149121893, 3638149121946, 196460052588000, 196460052588055, 196460052588055, 11198222997525633, 11198222997525691, 11198222997525750, 11198222997525810, 11198222997525871, 11198222997525871, 11198222997525997, 11198222997526061, 11198222997526191, 11198222997526191, 11198222997526325, 11198222997526393, 11198222997526531, 11198222997526601, 795073832824398753, 795073832824398753, 795073832824398899, 795073832824398973, 59630537461829934225, 59630537461829934301, 59630537461829934378, 4651181922022734887568, 4651181922022734887647, 4651181922022734887647, 376745735683841525912529, 376745735683841525912611, 376745735683841525912694, 376745735683841525912778, 376745735683841525912863, 376745735683841525912863, 376745735683841525913037, 376745735683841525913125, 376745735683841525913303, 376745735683841525913303, 376745735683841525913485, 376745735683841525913577, 376745735683841525913763, 376745735683841525913857, 35790844889964944961834465, 35790844889964944961834465, 35790844889964944961834659, 35790844889964944961834757, 3543293644106529551221660545, 3543293644106529551221660645
다음은 시퀀스에서 처음 10 개의 숫자입니다.
// Starting number of the sequence:
1
// 1 (previous number in the sequence)
// + 2 (current index in 1-indexed sequence)
// = 3 -> 3 - 2 (3 is divisible by 3, so we subtract the current index 2)
// = 1
1
// 1 (previous number in the sequence)
// + 3 (current index in 1-indexed sequence)
// = 4 -> 4 + 3 (4 is divisible by 2, so we first add the current index 3)
// = 7 -> 7 * 3 (and 4 is also divisible by 4, so we then also multiply the current index 3)
// = 21
21
// 21 (previous number in the sequence)
// + 4 (current index in 1-indexed sequence)
// = 25 (25 is not divisible by 2, 3 nor 4)
25
// 25 (previous number in the sequence)
// + 5 (current index in 1-indexed sequence)
// = 30 -> 30 + 5 (30 is divisible by 2, so we first add the current index 5)
// = 35 -> 35 - 5 (and 30 is also divisible by 3, so we then also subtract the current index 5)
// = 30
30
// 30 (previous number in the sequence)
// + 6 (current index in 1-indexed sequence)
// = 36 -> 36 + 6 (36 is divisible by 2, so we first add the current index 6)
// = 42 -> 42 - 6 (and 36 is also divisible by 3, so we then also subtract the current index 6)
// = 36 -> 36 * 6 (and 36 is also divisible by 4, so we then also multiply the current index 6)
// = 216
216
// 216 (previous number in the sequence)
// + 7 (current index in 1-indexed sequence)
// = 223 (223 is not divisible by 2, 3 nor 4)
223
// 223 (previous number in the sequence)
// + 8 (current index in 1-indexed sequence)
// = 231 -> 231 - 8 (231 is divisible by 3, so we subtract the current index 8)
// = 223
223
// 223 (previous number in the sequence)
// + 9 (current index in 1-indexed sequence)
// = 232 -> 232 + 9 (232 is divisible by 2, so we first add the current index 9)
// = 241 -> 241 * 9 (and 232 is also divisible by 4, so we then also multiply the current index 9)
// = 2169
2169
// 2169 (previous number in the sequence)
// + 10 (current index in 1-indexed sequence)
// 2179 (2179 is not divisible by 2, 3 nor 4)
2179
도전 규칙 :
- 귀하의 언어가 2 31 -1 보다 큰 것을 지원하지 않는 경우 , 최대 값까지 시퀀스를 계속할 수 있습니다.
1,517,792,609
). - 출력 형식은 유연합니다. 배열이나 목록, 공백, 쉼표 등으로 구분 된 문자열을 반환 할 수 있습니다.
일반 규칙: