-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprog.sf
24 lines (17 loc) · 808 Bytes
/
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
#!/usr/bin/ruby
# a(0) = 1, a(n) is the greatest prime factor of a(n-1)^2+1 for n > 0
# https://oeis.org/A031439
include("../../../factordb/auto.sf")
func a(n) is cached {
return 1 if (n == 0)
gpf(a(n-1)**2 + 1)
}
var bfile = File("bfile.txt").open_w.autoflush(true)
for n in (0..40) {
var k = a(n)
var row = "#{n} #{k}"
say row
bfile.say(row)
}
__END__
not FF: 202357123127832615416348896969070232098067701509826018077240404549968854418966799593181502860522389641262591349745548563861676982739228469102897726028663192421951991711503251989057227178276977635498601145096537049442303055541791316106459603732854884191874414763595124095609850051240311742452453230031524796934519779847623528665682183377943071592757884857384465641113975821687653741981329611275008720023789353109250