-
Notifications
You must be signed in to change notification settings - Fork 0
/
connection_to_cyclotomic_polynomials.sf
69 lines (50 loc) · 1.37 KB
/
connection_to_cyclotomic_polynomials.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/ruby
# Sequence by Wesley Ivan Hurt:
# a(n) = Sum_{i=1..n} denominator(n^i/i).
# OEIS:
# https://oeis.org/A279911
# Interesting formula:
# a(p^k) = (p^(2*k+1) + p + 2) / (2*(p+1)), for prime powers p^k.
func a(n) {
sum(1..n, {|k|
gcd(n,k) == 1 ? k : k.divisors.last_by {|d| gcd(d,n) == 1 }
})
}
say 20.range.grep{.is_prime_power}.map(a)
# (p^(2*k+1) + p + 2) / (2*(p+1)),
say 20.range.grep{.is_prime_power}.map {|pp|
var p = pp.prime_root
var k = pp.prime_power
#(p**(2*k + 1) + p + 2) / (2*p + 2)
k==2 ? (cyclotomic(10, p)+1 / 2) : ((p**(2*k + 1) + p + 2) / (2*p + 2))
}
var k = 14
var a = 20.of {|n|
(n**(k*2 + 1) + n + 2) / (2*(n+1))
}
for n in (1..100) {
var t = 20.of {|x|
cyclotomic(n, x) + 1 / 2
}
if (t == a) {
say "Found: #{n}"
}
}
__END__
# For k such that 2k+1 is prime,
# the values of n in cyclotomic(n,x) are the even semiprimes.
k = 2 -> (cyclotomic(10, n)+1)/2
k = 3 -> (cyclotomic(14, n)+1)/2
k = 5 -> (cyclotomic(22, n)+1)/2
k = 6 -> (cyclotomic(26, n)+1)/2
k = 8 -> (cyclotomic(34, n)+1)/2
k = 9 -> (cyclotomic(38, n)+1)/2
k = 11 -> (cyclotomic(46, n)+1)/2
k = 14 -> (cyclotomic(58, n)+1)/2
say 20.of{|n|
#n.is_prime_power ? (cyclotomic(10, n.prime_root)+1 / 2) : a(n)
#cyclotomic(10, n.prime)+1 / 2
#n.factor_map {|p|
# cyclotomic(10, p)+1 / 2
#}.sum
}