-
Notifications
You must be signed in to change notification settings - Fork 0
/
prog.sf
26 lines (18 loc) · 1.55 KB
/
prog.sf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/ruby
# a(1) = 2, a(n+1) = a(n)-th squarefree number.
# https://oeis.org/A071255
# a(n) = A005117(a(n-1)+1), a(1) = 2.
# Limit_{n->infinity} a(n+1)/a(n) = zeta(2). - ~~~~
# Cf. A013661.
var n = 1
var prev = n+1
for (1..100) {
n = nth_squarefree(n+1)
assert_eq(n.squarefree_count, prev)
print(n, ", ")
prev = n+1
}
__END__
# The first 90 terms of the sequence:
# (it took about 1 hour to compute all terms -- most time it took to compute the 90th term)
2, 3, 5, 7, 11, 17, 29, 46, 74, 119, 195, 319, 521, 859, 1407, 2315, 3810, 6267, 10303, 16942, 27862, 45822, 75381, 123998, 203969, 335507, 551886, 907818, 1493294, 2456374, 4040526, 6646389, 10932823, 17983831, 29582198, 48660745, 80043762, 131666710, 216583054, 356264837, 586032262, 963984389, 1585690726, 2608356634, 4290574601, 7057712419, 11609471501, 19096815466, 31413002109, 51672317362, 84997555010, 139815373942, 229987071849, 378313569907, 622300878862, 1023643915095, 1683826748681, 2769783981357, 4556112029758, 7494503890503, 12327964763051, 20278689213210, 33357106717701, 54870241211939, 90257929025521, 148468342259347, 244220634029670, 401726840743518, 660814165904146, 1086995733352806, 1788036312311593, 2941201842883639, 4838083108838558, 7958327723968749, 13090924388298190, 21533707492842997, 35421529040536114, 58266079818633598, 95843859635372351, 157656829812442869, 259335090229759666, 426589124648091743, 701710983680609659, 1154268302137814114, 1898695252469551143, 3123228503350160017, 5137504963712089306, 8450856933411884811, 13901102463829771365, 22866397009501362485,