A377337 Greatest positive integer k such that either k or k-1 is a multiple of A171977(n) but there does not exist any fully symmetric, k-celled, n-dimensional polyhypercube, or 0 if no such k exists.
0, 0, 77, 24
Offset: 1
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
HZeta := (s, v) -> Zeta(0, s, v): a := s -> (4^s*(HZeta(-s,1/4) - HZeta(-s,3/4)) + HZeta(-s,1)*(2^(s+1)-1))* 2^padic[ordp](2*(s+1),2): seq(a(n), n = 0..28);
a[n_] := 2^(IntegerExponent[n + 1, 2] + 1) (4^n (HurwitzZeta[-n, 1/4] - HurwitzZeta[-n, 3/4]) + HurwitzZeta[-n, 1] (2^(n + 1) - 1)); Table[FullSimplify[a[n]], {n, 0, 26}]
a(10^10) = 52010594272060810683. - _David A. Corneth_, Mar 26 2015
G := (x/((1-x)*(1+2*x))) * (1 + 2*x*mul(1+x^(2^k-1)+2*x^(2^k),k=0..20)); # N. J. A. Sloane, May 20 2009, Jun 05 2009 # From N. J. A. Sloane, Dec 25 2009: A139250 is T, A139251 is a. a:=[0,1,2,4]; T:=[0,1,3,7]; M:=10; for k from 1 to M do a:=[op(a),2^(k+1)]; T:=[op(T),T[nops(T)]+a[nops(a)]]; for j from 1 to 2^(k+1)-1 do a:=[op(a), 2*a[j+1]+a[j+2]]; T:=[op(T),T[nops(T)]+a[nops(a)]]; od: od: a; T;
CoefficientList[ Series[ (x/((1 - x)*(1 + 2x))) (1 + 2x*Product[1 + x^(2^k - 1) + 2*x^(2^k), {k, 0, 20}]), {x, 0, 53}], x] (* Robert G. Wilson v, Dec 06 2010 *) a[0] = 0; a[n_] := a[n] = Module[{m, k}, m = 2^(Length[IntegerDigits[n, 2]] - 1); k = (2m^2+1)/3; If[n == m, k, k + 2 a[n - m] + a[n - m + 1] - 1]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Oct 06 2018, after David A. Corneth *)
A139250(n,print_all=0)={my(p=[], /* set of "used" points. Points are written as complex numbers, c=x+iy. Toothpicks are of length 2 */ ee=[[0,1]], /* list of (exposed) endpoints. Exposed endpoints are listed as [c,d] where c=x+iy is the position of the endpoint, and d (unimodular) is the direction */ c,d,ne, cnt=1); print_all && print1("0,1"); n<2 && return(n); for(i=2,n, p=setunion(p, Set(Mat(ee~)[,1])); /* add endpoints (discard directions) from last move to "used" points */ ne=[]; /* new (exposed) endpoints */ for( k=1, #ee, /* add endpoints of new toothpicks if not among the used points */ setsearch(p, c=ee[k][1]+d=ee[k][2]*I) || ne=setunion(ne,Set([[c,d]])); setsearch(p, c-2*d) || ne=setunion(ne,Set([[c-2*d,-d]])); ); /* using Set() we have the points sorted, so it's easy to remove those which finally are not exposed because they touch a new toothpick */ forstep( k=#ee=eval(ne), 2, -1, ee[k][1]==ee[k-1][1] && k-- && ee=vecextract(ee,Str("^"k"..",k+1))); cnt+=#ee; /* each exposed endpoint will give a new toothpick */ print_all && print1(","cnt));cnt} \\ M. F. Hasler, Apr 14 2009
\\works for n > 0 a(n) = {my(k = (2*msb(n)^2 + 1) / 3); if(n==msb(n),k , k + 2*a(n-msb(n)) + a(n - msb(n) + 1) - 1)} msb(n)=my(t=0);while(n>>t>0,t++);2^(t-1)\\ David A. Corneth, Mar 26 2015
def msb(n): t = 0 while n>>t > 0: t += 1 return 2**(t - 1) def a(n): k = (2 * msb(n)**2 + 1) / 3 return 0 if n == 0 else k if n == msb(n) else k + 2*a(n - msb(n)) + a(n - msb(n) + 1) - 1 [a(n) for n in range(101)] # Indranil Ghosh, Jul 01 2017, after David A. Corneth's PARI script
For example, 2^1|2, 2^2|4, 2^1|6, 2^3|8, 2^1|10, 2^2|12, ... giving the initial terms 1, 2, 1, 3, 1, 2, ... From _Omar E. Pol_, Jun 12 2009: (Start) Triangle begins: 1; 2,1; 3,1,2,1; 4,1,2,1,3,1,2,1; 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1; 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1; 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,6,1,2,1,3,... (End) S(0) = {} S(1) = 1 S(2) = 1, 2, 1 S(3) = 1, 2, 1, 3, 1, 2, 1 S(4) = 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1. - Yann David (yann_david(AT)hotmail.com), Mar 21 2010 From _Joerg Arndt_, Nov 12 2012: (Start) The 16 compositions of 5 as lists in lexicographic order: [ n] a(n) composition [ 1] [ 1] [ 1 1 1 1 1 ] [ 2] [ 2] [ 1 1 1 2 ] [ 3] [ 1] [ 1 1 2 1 ] [ 4] [ 3] [ 1 1 3 ] [ 5] [ 1] [ 1 2 1 1 ] [ 6] [ 2] [ 1 2 2 ] [ 7] [ 1] [ 1 3 1 ] [ 8] [ 4] [ 1 4 ] [ 9] [ 1] [ 2 1 1 1 ] [10] [ 2] [ 2 1 2 ] [11] [ 1] [ 2 2 1 ] [12] [ 3] [ 2 3 ] [13] [ 1] [ 3 1 1 ] [14] [ 2] [ 3 2 ] [15] [ 1] [ 4 1 ] [16] [ 5] [ 5 ] a(n) is the last part in each list. (End) From _Omar E. Pol_, Aug 20 2013: (Start) Also written as a triangle in which the right border gives A000027 and row lengths give A011782 and row sums give A000079 the sequence begins: 1; 2; 1,3; 1,2,1,4; 1,2,1,3,1,2,1,5; 1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,6; 1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1,7; (End) G.f. = x + 2*x^2 + x^3 + 3*x^4 + x^5 + 2*x^6 + x^7 + 4*x^8 + x^9 + 2*x^10 + ...
a001511 n = length $ takeWhile ((== 0) . (mod n)) a000079_list -- Reinhard Zumkeller, Sep 27 2011
a001511 n | odd n = 1 | otherwise = 1 + a001511 (n `div` 2) -- Walt Rorie-Baety, Mar 22 2013
nmax=5;r=1;for n=2:nmax;r=[r n r];end % Adriano Caroli, Feb 26 2016
[Valuation(2*n,2): n in [1..105]]; // Bruno Berselli, Nov 23 2015
A001511 := n->2-wt(n)+wt(n-1); # where wt is defined in A000120 # This is the binary logarithm of the denominator of (256^n-1)B_{8n}/n, in Maple parlance a := n -> log[2](denom((256^n-1)*bernoulli(8*n)/n)). - Peter Luschny, May 31 2009 A001511 := n -> padic[ordp](2*n,2): seq(A001511(n), n=1..105); # Peter Luschny, Nov 26 2010 a:= n-> ilog2((Bits[Xor](2*n, 2*n-1)+1)/2): seq(a(n), n=1..50); # Gary Detlefs, Dec 13 2018
Array[ If[ Mod[ #, 2] == 0, FactorInteger[ # ][[1, 2]], 0] &, 105] + 1 (* or *) Nest[ Flatten[ # /. a_Integer -> {1, a + 1}] &, {1}, 7] (* Robert G. Wilson v, Mar 04 2005 *) IntegerExponent[2*n, 2] (* Alexander R. Povolotsky, Aug 19 2011 *) myHammingDistance[n_, m_] := Module[{g = Max[m, n], h = Min[m, n]}, b1 = IntegerDigits[g, 2]; b2 = IntegerDigits[h, 2, Length[b1]]; HammingDistance[b1, b2]] (* Vladimir Shevelev A206853 *) Table[ myHammingDistance[n, n - 1], {n, 111}] (* Robert G. Wilson v, Apr 05 2012 *) Table[Position[Reverse[IntegerDigits[n,2]],1,1,1],{n,110}]//Flatten (* Harvey P. Dale, Aug 18 2017 *)
a(n) = sum(k=0,floor(log(n)/log(2)),floor(n/2^k)-floor((n-1)/2^k)) /* Ralf Stephan */
a(n)=if(n%2,1,factor(n)[1,2]+1) /* Jon Perry, Jun 06 2004 */
{a(n) = if( n, valuation(n, 2) + 1, 0)}; /* Michael Somos, Sep 30 2006 */
{a(n)=if(n==1,1,polcoeff(x-sum(k=1, n-1, a(k)*x^k*(1-x^k)*(1-x+x*O(x^n))), n))} /* Paul D. Hanna, Jun 22 2007 */
def a(n): return bin(n)[2:][::-1].index("1") + 1 # Indranil Ghosh, May 11 2017
A001511 = lambda n: (n&-n).bit_length() # M. F. Hasler, Apr 09 2020
def A001511(n): return (~n & n-1).bit_length()+1 # Chai Wah Wu, Jul 01 2022
[valuation(2*n,2) for n in (1..105)] # Bruno Berselli, Nov 23 2015
(define (A001511 n) (let loop ((n n) (e 1)) (if (odd? n) e (loop (/ n 2) (+ 1 e))))) ;; Antti Karttunen, Oct 06 2017
2^3 divides 24, but 2^4 does not divide 24, so a(24) = 8. 2^0 divides 25, but 2^1 does not divide 25, so a(25) = 1. 2^1 divides 26, but 2^2 does not divide 26, so a(26) = 2. Per _Marc LeBrun_'s 2000 comment, a(n) can also be determined with bitwise operations in two's complement. For example, given n = 48, we see that n in binary in an 8-bit byte is 00110000 while -n is 11010000. Then 00110000 AND 11010000 = 00010000, which is 16 in decimal, and therefore a(48) = 16. G.f. = x + 2*x^2 + x^3 + 4*x^4 + x^5 + 2*x^6 + x^7 + 8*x^8 + x^9 + ...
import Data.Bits ((.&.)) a006519 n = n .&. (-n) :: Integer -- Reinhard Zumkeller, Mar 11 2012, Dec 29 2011
using IntegerSequences [EvenPart(n) for n in 1:102] |> println # Peter Luschny, Sep 25 2021
[2^Valuation(n, 2): n in [1..100]]; // Vincenzo Librandi, Mar 27 2015
with(numtheory): for n from 1 to 200 do if n mod 2 = 1 then printf(`%d,`,1) else printf(`%d,`,2^ifactors(n)[2][1][2]) fi; od: A006519 := proc(n) if type(n,'odd') then 1 ; else for f in ifactors(n)[2] do if op(1,f) = 2 then return 2^op(2,f) ; end if; end do: end if; end proc: # R. J. Mathar, Oct 25 2010 A006519 := n -> 2^padic[ordp](n,2): # Peter Luschny, Nov 26 2010
lowestOneBit[n_] := Block[{k = 0}, While[Mod[n, 2^k] == 0, k++]; 2^(k - 1)]; Table[lowestOneBit[n], {n, 102}] (* Robert G. Wilson v Nov 17 2004 *) Table[2^IntegerExponent[n, 2], {n, 128}] (* Jean-François Alcover, Feb 10 2012 *) Table[BitAnd[BitNot[i - 1], i], {i, 1, 102}] (* Peter Luschny, Oct 10 2019 *)
{a(n) = 2^valuation(n, 2)};
a(n)=1<Joerg Arndt, Jun 10 2011
a(n)=bitand(n,-n); \\ Joerg Arndt, Jun 10 2011
a(n)=direuler(p=2,n,if(p==2,1/(1-2*X),1/(1-X)))[n] \\ Ralf Stephan, Mar 27 2015
def A006519(n): return n&-n # Chai Wah Wu, Jul 06 2022
(1 to 128).map(Integer.lowestOneBit()) // _Alonso del Arte, Mar 04 2020
Triangle begins: 1; 1, 2; 1, 4, 4; 1, 6, 12, 8; 1, 8, 24, 32, 16; 1, 10, 40, 80, 80, 32; 1, 12, 60, 160, 240, 192, 64; 1, 14, 84, 280, 560, 672, 448, 128; 1, 16, 112, 448, 1120, 1792, 1792, 1024, 256; 1, 18, 144, 672, 2016, 4032, 5376, 4608, 2304, 512; 1, 20, 180, 960, 3360, 8064, 13440, 15360, 11520, 5120, 1024; 1, 22, 220, 1320, 5280, 14784, 29568, 42240, 42240, 28160, 11264, 2048; 1, 24, 264, 1760, 7920, 25344, 59136, 101376, 126720, 112640, 67584, 24576, 4096; From _Peter Bala_, Apr 20 2012: (Start) The triangle can be written as the matrix product A038207*(signed version of A013609). |.1................||.1..................| |.2...1............||-1...2..............| |.4...4...1........||.1..-4...4..........| |.8..12...6...1....||-1...6...-12...8....| |16..32..24...8...1||.1..-8....24.-32..16| |..................||....................| (End)
a013609 n = a013609_list !! n a013609_list = concat $ iterate ([1,2] *) [1] instance Num a => Num [a] where fromInteger k = [fromInteger k] (p:ps) + (q:qs) = p + q : ps + qs ps + qs = ps ++ qs (p:ps) * qs'@(q:qs) = p * q : ps * qs' + [p] * qs * = [] -- Reinhard Zumkeller, Apr 02 2011
a013609 n k = a013609_tabl !! n !! k a013609_row n = a013609_tabl !! n a013609_tabl = iterate (\row -> zipWith (+) ([0] ++ row) $ zipWith (+) ([0] ++ row) (row ++ [0])) [1] -- Reinhard Zumkeller, Jul 22 2013, Feb 27 2013
[2^k*Binomial(n,k): k in [0..n], n in [0..15]]; // G. C. Greubel, Sep 17 2021
bin2:=proc(n,k) option remember; if k<0 or k>n then 0 elif k=0 then 1 else 2*bin2(n-1,k-1)+bin2(n-1,k); fi; end; # N. J. A. Sloane, Jun 01 2009
Flatten[Table[CoefficientList[(1 + 2*x)^n, x], {n, 0, 10}]][[1 ;; 59]] (* Jean-François Alcover, May 17 2011 *) BinomialROW[n_, k_, t_] := Sum[Binomial[n, k]*Binomial[k, j]*(-1)^(k - j)*t^j, {j, 0, k}]; Column[Table[BinomialROW[n, k, 3], {n, 0, 10}, {k, 0, n}], Center] (* Kolosov Petro, Jan 28 2019 *)
a(n,k):=coeff(expand((1+2*x)^n),x^k); create_list(a(n,k),n,0,6,k,0,n); /* Emanuele Munarini, Nov 21 2012 */
/* same as in A092566 but use */ steps=[[1,0], [1,1], [1,1]]; /* note double [1,1] */ /* Joerg Arndt, Jul 01 2011 */
flatten([[2^k*binomial(n,k) for k in (0..n)] for n in (0..15)]) # G. C. Greubel, Sep 17 2021
A003188[n_] := BitXor[n, Floor[n/2]]; A006068[n_] := If[n == 0, 0, BitXor @@ Table[Floor[n/2^m], {m, 0, Floor[Log[2, n]]}]]; a[n_] := If[n == 0, 0, A003188[1 + A006068[n-1]]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 23 2016 *)
A003188(n) = bitxor(n, floor(n/2)); A006068(n) = if(n<2, n, {my(m = A006068(floor(n/2))); 2*m + (n%2 + m%2)%2}); for(n=0, 100, print1(if(n<1, 0, A003188(1 + A006068(n - 1)))", ")) \\ Indranil Ghosh, Mar 31 2017
def A003188(n): return n^(n//2) def A006068(n): if n<2: return n m = A006068(n//2) return 2*m + (n%2 + m%2)%2 def a(n): return 0 if n<1 else A003188(1 + A006068(n - 1)) print([a(n) for n in range(0, 101)]) # Indranil Ghosh, Mar 31 2017
def A268717(n): k, m = n-1, n-1>>1 while m > 0: k ^= m m >>= 1 return k+1^ k+1>>1 # Chai Wah Wu, Jun 29 2022
(define (A268717 n) (if (zero? n) n (A003188 (A066194 n))))
{0}~Join~Table[1 + BitXor[#, Floor[#/2]] &[BitXor @@ Table[Floor[n/2^m], {m, 0, Floor[Log[2, n]]}] - 1], {n, 81}] (* Michael De Vlieger, Feb 29 2016, after Jean-François Alcover at A006068 and Robert G. Wilson v at A003188 *)
a003188(n)=bitxor(n, n>>1); a006068(n)= { my( s=1, ns ); while ( 1, ns = n >> s; if ( 0==ns, break() ); n = bitxor(n, ns); s <<= 1; ); return (n); } \\ by Joerg Arndt a(n)=if(n==0, 0, 1 + a003188(a006068(n) - 1)); \\ Indranil Ghosh, Jun 07 2017
def a003188(n): return n^(n>>1) def a006068(n): s=1 while True: ns=n>>s if ns==0: break n=n^ns s<<=1 return n def a(n): return 0 if n==0 else 1 + a003188(a006068(n) - 1) # Indranil Ghosh, Jun 07 2017
(define (A268718 n) (if (zero? n) n (A105081 (A006068 n))))
a(4)=8 because for n=4 and for the first 4 odd primes {3, 5, 7, 11}, the term (p^n-1)/2 gives {40, 312, 1200, 7320} with a GCD of 8.
a[n_] := GCD @@ Array[(Prime[# +1]^n -1)/2 &, n]; Array[a, 90] (* slightly modified by Robert G. Wilson v, Jan 01 2018 *) a[n_] := If[EvenQ[n], 2^(FactorInteger[n][[1]][[2]] + 1), 1]; Array[a, 90] (* Frank M Jackson, Jul 28 2018 *)
a(n) = gcd(vector(n, i, (prime(i+1)^n-1)/2)) \\ Iain Fox, Dec 29 2017
a(n)=if(n%2,1,2)<Charles R Greathouse IV, Jan 06 2018
[seq(TZ2(abs(N2Z(n))), n=1..120)]; # using TZ2 from A065174 N2Z := n -> ((-1)^n)*floor(n/2); Z2N := z -> 2*abs(z)+`if`((z < 1),1,0); # Alternative: A065176 := n -> `if`(n = 1, 0, 2^padic:-ordp(n - 1 + irem(n-1, 2), 2)): seq(A065176(n), n = 1..99); # Peter Luschny, Nov 14 2021
a[n_] := 2^IntegerExponent[n - Mod[n, 2], 2]; a[1] = 0; Array[a, 100] (* Amiram Eldar, May 22 2025 *)
a(n) = if(n==1,0, 1<Kevin Ryde, Jul 09 2021
def A065176(n): s, h = 1, n // 2 if 0 == h: return 0 while 0 == h % 2: h //= 2 s += s return s + s print([A065176(n) for n in range(1, 100)]) # Peter Luschny, Nov 14 2021
Comments