%I #45 Oct 01 2022 13:15:39
%S 1,2,4,5,6,6,6,3,5,6,7,9,8,7,7,9,6,8,6,9,6,8,9,12,11,5,9,8,7,7,11,9,
%T 11,11,9,10
%N Each c(i) is "multiply" (*) or "divide" (/); a(n) is number of choices for c(1),..,c(n) so that the reduced fraction 1 c(1) 2 c(2) 3 c(3) 5 ... c(n) prime(n) is equal to (k*m+1)/m for a positive integer m and a nonnegative integer k.
%H Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a059/A059583.java">Java program</a> (github)
%e For n = 4 there are five possibilities: 1/2/3/5/7 = 1/210, 1/2*3/5*7 = 21/10, 1/2*3*5/7 = 15/14, 1/2*3*5*7 = 105/2, and 1*2/3*5*7 = 70/3. So a(4) = 5.
%o (Python)
%o from math import prod
%o from itertools import combinations
%o from sympy import prime, primerange
%o def a(n):
%o pset = set(primerange(2, prime(n)+1))
%o m, c = prod(pset), 1 # count 1/2/3/.../prime(n)
%o for r in range(1, len(pset)):
%o first = 1
%o for dens in combinations(pset, r):
%o den = prod(dens)
%o num = m//den
%o if dens[0] != first:
%o if den > num: break
%o first = dens[0]
%o if num%den == 1: c += 1
%o return c
%o print([a(n) for n in range(1, 21)]) # _Michael S. Branicky_, Sep 30 2022
%K nonn,more
%O 1,2
%A _Naohiro Nomoto_, Feb 17 2001
%E More terms from _Sascha Kurz_, Oct 16 2001
%E a(34)-a(36) from _Sean A. Irvine_, Sep 29 2022
%E Definition clarified by _N. J. A. Sloane_, Oct 01 2022
|