A354765 a(n) is a binary encoded version of A355057(n).
0, 0, 1, 3, 6, 7, 13, 15, 27, 59, 122, 123, 243, 499, 501, 511, 1007, 2031, 4047, 8143, 16271, 32655, 65422, 65423, 130831, 261903, 523791, 1048079, 2096651, 2096671, 4193813, 4193815, 4193311, 8387615, 16775199, 33552415, 67104799, 134213663, 268427295, 536862751, 1073725471, 2147467295, 4294934559, 8589901855, 17179803679
Offset: 1
Examples
For n = 7 the forbidden primes are 2, 5, 7 = prime(1), prime(3) and prime(4). Their product is A355057(7) = 70. Then a(7) = 2^0 + 2^2 + 2^3 = 13.
Links
- N. J. A. Sloane, Table of n, a(n) for n = 1..1000
Programs
-
Maple
# To get first M terms: with(numtheory); M:=20; ans:=[0,0,1]; for i from 4 to M do S:={}; j1:=floor((i+1)/2); j2:=i-1; for j from j1 to j2 do S:={op(S), op(factorset(b252[j]))} od: plis:=sort(convert(S,list)); t3:=0; for ii from 1 to nops(plis) do p:=plis[ii]; p2:=pi(p); t3:=t3+2^(p2-1); od: ans:=[op(ans),t3]; od: ans;
-
Python
from math import gcd, lcm from itertools import count, islice from collections import deque from sympy import primepi, primefactors def A354765_gen(): # generator of terms aset, aqueue, c, b, f = {1}, deque([1]), 2, 1, True yield 0 while True: for m in count(c): if m not in aset and gcd(m,b) == 1: yield sum(2**(primepi(p)-1) for p in primefactors(b)) aset.add(m) aqueue.append(m) if f: aqueue.popleft() b = lcm(*aqueue) f = not f while c in aset: c += 1 break A354765_list = list(islice(A354765_gen(),20)) # Chai Wah Wu, Jun 18 2022
Comments