-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct_of_prime_sigmas_of_divisors.sf
50 lines (40 loc) · 2.3 KB
/
product_of_prime_sigmas_of_divisors.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
#!/usr/bin/ruby
# Daniel "Trizen" Șuteu
# Date: 20 November 2017
# https://github.com/trizen
# Product of the prime sigmas of the divisors of n.
# a(n) = Prod_{d|n, sigma(d) is prime} sigma(d)
# See the plot of log(a(n)), which looks very interesting.
func a(n) is cached {
n.divisors.map { .sigma }.grep{ .is_prime }.prod
}
say (0..50 -> grep {|n| a(n) == 1 }) # ?
say (0..100 -> grep {|n| a(n) == 3 }) # https://oeis.org/A039956
say (0..350 -> grep {|n| a(n) == 13 }) # ?
say (0..130 -> grep {|n| a(n) == 21 }) # https://oeis.org/A133466
say (0..950 -> grep {|n| a(n) == 31 }) # ?
say (0..650 -> grep {|n| a(n) == 39 }) # ?
say (0..1750 -> grep {|n| a(n) == 93 }) # ?
say (0..800 -> grep {|n| a(n) == 273 }) # ?
say (0..10000 -> grep {|n| a(n) == 307 }) # ?
say (0..6100 -> grep {|n| a(n) == 403 }) # ?
say (0..355 -> grep {|n| a(n) == 651 }) # ?
say (0..20000 -> grep {|n| a(n) == 921 }) # ?
say ('-' * 80)
# Uniq values of the function for n=1..1000
say (1..1000 -> map {|n| a(n) }.uniq.sort)
__END__
[0, 1, 3, 5, 7, 11, 13, 15, 17, 19, 21, 23, 29, 31, 33, 35, 37, 39, 41, 43, 47, 49]
[2, 6, 10, 14, 22, 26, 30, 34, 38, 42, 46, 58, 62, 66, 70, 74, 78, 82, 86, 94, 98]
[9, 27, 45, 63, 81, 99, 117, 135, 153, 171, 189, 207, 243, 261, 279, 297, 315, 333]
[4, 8, 12, 20, 24, 28, 40, 44, 52, 56, 60, 68, 76, 84, 88, 92, 104, 116, 120, 124]
[25, 75, 125, 175, 275, 325, 375, 425, 475, 525, 575, 625, 725, 775, 825, 875, 925]
[18, 54, 90, 126, 162, 198, 234, 270, 306, 342, 378, 414, 486, 522, 558, 594, 630]
[50, 150, 250, 350, 550, 650, 750, 850, 950, 1050, 1150, 1250, 1450, 1550, 1650, 1750]
[36, 72, 108, 180, 216, 252, 324, 360, 396, 468, 504, 540, 612, 648, 684, 756, 792]
[289, 867, 1445, 2023, 3179, 3757, 4335, 4913, 5491, 6069, 6647, 8381, 8959, 9537]
[225, 675, 1125, 1575, 2025, 2475, 2925, 3375, 3825, 4275, 4725, 5175, 5625, 6075]
[16, 32, 48, 80, 96, 100, 112, 160, 176, 200, 208, 224, 240, 272, 300, 304, 336, 352]
[578, 1734, 2890, 4046, 6358, 7514, 8670, 9826, 10982, 12138, 13294, 16762, 17918, 19074]
--------------------------------------------------------------------------------
[1, 3, 13, 21, 31, 39, 93, 273, 307, 403, 651, 921, 1209, 8463, 14209, 20181, 82677, 1074801]