A374664
Nonnegative numbers whose binary expansion has no ones in common with some of its cyclic shifts.
Original entry on oeis.org
0, 2, 4, 8, 9, 10, 12, 16, 17, 18, 20, 24, 32, 33, 34, 35, 36, 40, 42, 48, 49, 56, 64, 65, 66, 67, 68, 72, 73, 74, 76, 80, 82, 84, 96, 97, 100, 112, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 140, 144, 145, 146, 148, 150, 152, 153, 160, 161, 162
Offset: 1
The first terms, with their binary expansion and an appropriate cyclic shift, are:
n a(n) bin(a(n)) cyc
-- ---- --------- ------
1 0 0 0
2 2 10 01
3 4 100 001
4 8 1000 0001
5 9 1001 0110
6 10 1010 0101
7 12 1100 0011
8 16 10000 00001
9 17 10001 00110
10 18 10010 00101
11 20 10100 01001
12 24 11000 00011
13 32 100000 000001
14 33 100001 000110
15 34 100010 000101
16 35 100011 011100
-
is(n) = { my (x = max(exponent(n), 0), s = n); for (i = 0, x, s = (s >> 1) + if (s%2, 2^x, 0); if (bitand(s, n)==0, return (1););); return (0); }
A374770
a(n) is the number of subsets x of Z_n such that #x * #y = n and x + y = Z_n for some subset y of Z_n.
Original entry on oeis.org
1, 3, 4, 11, 6, 24, 8, 59, 40, 68, 12, 284, 14, 192, 384, 795, 18, 1590, 20, 2876, 2552, 2192, 24, 17972, 3156, 8388, 20560, 35620, 30, 116474, 32, 144091, 178512, 131396, 94968, 1118426, 38, 524688, 1596560, 2569884, 42, 7280934, 44
Offset: 1
For n = 8: the principal subsets x (unique up to translation) alongside an appropriate subset y and the number of distinct translations are:
x y #
----------------- ----------------- -
{0} {0,1,2,3,4,5,6,7} 8
{0,1} {0,2,4,6} 8
{0,2} {0,1,4,5} 8
{0,3} {0,2,4,6} 8
{0,4} {0,1,2,3} 4
{0,1,2,3} {0,4} 8
{0,2,3,5} {0,4} 8
{0,1,4,5} {0,2} 4
{0,2,4,6} {0,1} 2
{0,1,2,3,4,5,6,7} {0} 1
So a(8) = 8 + 8 + 8 + 8 + 4 + 8 + 8 + 4 + 2 + 1 = 59.
-
from itertools import combinations
from sympy import divisors, isprime
def A374770(n):
if isprime(n): return n+1
s = {}
for d in divisors(n,generator=True):
t = {}
for a in combinations(range(n),d):
for i in range(1,n):
if (w:=tuple((i+b)%n for b in a)) in t:
t[w]+=1
break
else:
t[a] = 1
s[d] = t
c = 0
for d in divisors(n,generator=True):
for a in s[d]:
for b in s[n//d]:
if len({(x+y)%n for x in a for y in b})==n:
c += s[d][a]
break
return c # Chai Wah Wu, Jul 22 2024
Showing 1-2 of 2 results.
Comments