cp's OEIS Frontend

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.

Showing 1-10 of 15 results. Next

A079947 Partial sums of A030300.

Original entry on oeis.org

1, 1, 1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36
Offset: 1

Views

Author

N. J. A. Sloane, Feb 22 2003

Keywords

Programs

  • Mathematica
    Accumulate@ Flatten@ Table[1 - Mod[n, 2], {n, 0, 6}, {2^n}] (* Michael De Vlieger, Oct 29 2022 *)
  • PARI
    a(n) = my(k=logint(n,2), p=(2<Kevin Ryde, Jul 13 2019 */
    
  • Python
    def A079947(n): return n-((1<Chai Wah Wu, Jan 30 2023

Formula

a(n) = (n+1+(2/3)*(4^e_4-1)+(-1)^e_2*(n-1-2*(4^e_4-1)))/2 where e_4=floor(log[4](n)) and e_2=floor(log[2](n))=floor(log[4](n^2)). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 22 2003
a(n) = n - A079954(n). Let k=A000523(n), then a(n) = n-A000975(k) if k even, or a(n) = A000975(k) if k odd. - Kevin Ryde, Jul 13 2019

A071859 Determinant of M_n where M_n is the n X n matrix m_(i,j) = A030300(i+j).

Original entry on oeis.org

0, 0, -1, 1, 1, -1, 0, 0, 1, 1, -1, -1, 0, 0, -1, 1, 1, 1, -2, 2, 3, -3, -1, 1, -2, -2, 1, 1, 1, -1, 0, 0, 1, 1, -1, 1, 2, -2, -1, -1, 3, 3, -2, -2, -1, 1, -1, -1, 0, 0, 1, -1, -1, 1, 0, 0, 1, 1, -1, -1, 0, 0, -1, 1, 1, 1, -2, 2, 3, -3, -1, -1, 4, 4, -3, -3
Offset: 1

Views

Author

Benoit Cloitre, Jun 09 2002

Keywords

Comments

a(n)=0 for n=1,2,7,8,13,14,31,32,49,50,55,56,61,62...hence if a(n)=0, n odd it seems that a(n+1)=0. It seems also that if a(n)=0 (n odd ) then n == 1 mod 6 (converse doesn't hold).

Crossrefs

Cf. A030300.

Programs

  • PARI
    for(n=1,70,print1(matdet(matrix(n,n,i,j,length(binary(j+i))%2)),","))

Extensions

Name corrected by Nathaniel Johnston, Sep 26 2011

A037861 (Number of 0's) - (number of 1's) in the base-2 representation of n.

Original entry on oeis.org

1, -1, 0, -2, 1, -1, -1, -3, 2, 0, 0, -2, 0, -2, -2, -4, 3, 1, 1, -1, 1, -1, -1, -3, 1, -1, -1, -3, -1, -3, -3, -5, 4, 2, 2, 0, 2, 0, 0, -2, 2, 0, 0, -2, 0, -2, -2, -4, 2, 0, 0, -2, 0, -2, -2, -4, 0, -2, -2, -4, -2, -4, -4, -6, 5, 3, 3, 1, 3, 1, 1, -1, 3
Offset: 0

Views

Author

Keywords

Comments

-Sum_{n>=1} a(n)/((2*n)*(2*n+1)) = the "alternating Euler constant" log(4/Pi) = 0.24156... - (see A094640 and Sondow 2005, 2010).
a(A072600(n)) < 0; a(A072601(n)) <= 0; a(A031443(n)) = 0; a(A072602(n)) >= 0; a(A072603(n)) > 0; a(A031444(n)) = 1; a(A031448(n)) = -1; abs(a(A089648(n))) <= 1. - Reinhard Zumkeller, Feb 07 2015

Crossrefs

Cf. A031443 for n when a(n)=0, A053738 for n when a(n) odd, A053754 for n when a(n) even, A030300 for a(n+1) mod 2.
See A268289 for a recurrence based on this sequence.

Programs

  • Haskell
    a037861 n = a023416 n - a000120 n  -- Reinhard Zumkeller, Aug 01 2013
    
  • Maple
    A037861:= proc(n) local L;
         L:= convert(n,base,2);
         numboccur(0,L) - numboccur(1,L)
    end proc:
    map(A037861, [$0..100]); # Robert Israel, Mar 08 2016
  • Mathematica
    Table[Count[ IntegerDigits[n, 2], 0] - Count[IntegerDigits[n, 2], 1], {n, 0, 75}]
  • PARI
    a(n) = if (n==0, 1, 1 + logint(n, 2) - 2*hammingweight(n)); \\ Michel Marcus, May 15 2020 and Jun 16 2020
  • Python
    def A037861(n):
        return 2*format(n,'b').count('0')-len(format(n,'b')) # Chai Wah Wu, Mar 07 2016
    

Formula

From Henry Bottomley, Oct 27 2000: (Start)
a(n) = A023416(n) - A000120(n) = A029837(n) - 2*A000120(n) = 2*A023416(n) - A029837(n).
a(2*n) = a(n) + 1; a(2*n + 1) = a(2*n) - 2 = a(n) - 1. (End)
G.f. satisfies A(x) = (1 + x)*A(x^2) - x*(2 + x)/(1 + x). - Franklin T. Adams-Watters, Dec 26 2006
a(n) = b(n) for n > 0 with b(0) = 0 and b(n) = b(floor(n/2)) + (-1)^(n mod 2). - Reinhard Zumkeller, Dec 31 2007
G.f.: 1 + (1/(1 - x))*Sum_{k>=0} x^(2^k)*(x^(2^k) - 1)/(1 + x^(2^k)). - Ilya Gutkovskiy, Apr 07 2018

A065359 Alternating bit sum for n: replace 2^k with (-1)^k in binary expansion of n.

Original entry on oeis.org

0, 1, -1, 0, 1, 2, 0, 1, -1, 0, -2, -1, 0, 1, -1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, -1, 0, 1, 2, 0, 1, -1, 0, -2, -1, 0, 1, -1, 0, -2, -1, -3, -2, -1, 0, -2, -1, 0, 1, -1, 0, 1, 2, 0, 1, -1, 0, -2, -1, 0, 1, -1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, -1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, 1, 2, 0, 1, 2, 3, 1, 2, 0, 1, -1, 0, 1, 2, 0, 1, -1, 0, -2
Offset: 0

Views

Author

Marc LeBrun, Oct 31 2001

Keywords

Comments

Notation: (2)[n](-1)
From David W. Wilson and Ralf Stephan, Jan 09 2007: (Start)
a(n) is even iff n in A001969; a(n) is odd iff n in A000069.
a(n) == 0 (mod 3) iff n == 0 (mod 3).
a(n) == 0 (mod 6) iff (n == 0 (mod 3) and n/3 not in A036556).
a(n) == 3 (mod 6) iff (n == 0 (mod 3) and n/3 in A036556). (End)
a(n) = A030300(n) - A083905(n). - Ralf Stephan, Jul 12 2003
From Robert G. Wilson v, Feb 15 2011: (Start)
First occurrence of k and -k: 0, 1, 2, 5, 10, 21, 42, 85, ..., (A000975); i.e., first 0 occurs for 0, first 1 occurs for 1, first -1 occurs at 2, first 2 occurs for 5, etc.;
a(n)=-3 only if n mod 3 = 0,
a(n)=-2 only if n mod 3 = 1,
a(n)=-1 only if n mod 3 = 2,
a(n)= 0 only if n mod 3 = 0,
a(n)= 1 only if n mod 3 = 1,
a(n)= 2 only if n mod 3 = 2,
a(n)= 3 only if n mod 3 = 0, ..., . (End)
a(n) modulo 2 is the Prouhet-Thue-Morse sequence A010060. - Philippe Deléham, Oct 20 2011
In the Koch curve, number the segments starting with n=0 for the first segment. The net direction (i.e., the sum of the preceding turns) of segment n is a(n)*60 degrees. This is since in the curve each base-4 digit 0,1,2,3 of n is a sub-curve directed respectively 0, +60, -60, 0 degrees, which is the net 0,+1,-1,0 of two bits in the sum here. - Kevin Ryde, Jan 24 2020

Examples

			Alternating bit sum for 11 = 1011 in binary is 1 - 1 + 0 - 1 = -1, so a(11) = -1.
		

Crossrefs

Cf. A005536 (partial sums), A056832 (abs first differences), A010060 (mod 2), A039004 (indices of 0's).
Cf. also A004718.
Cf. analogous sequences for bases 3-10: A065368, A346688, A346689, A346690, A346691, A346731, A346732, A055017 and also A373605 (for primorial base).

Programs

  • Haskell
    a065359 0 = 0
    a065359 n = - a065359 n' + m where (n', m) = divMod n 2
    -- Reinhard Zumkeller, Mar 20 2015
    
  • Maple
    A065359 := proc(n) local dgs ; dgs := convert(n,base,2) ; add( -op(i,dgs)*(-1)^i,i=1..nops(dgs)) ; end proc: # R. J. Mathar, Feb 04 2011
  • Mathematica
    f[0]=0; f[n_] := Plus @@ (-(-1)^Range[ Floor[ Log2@ n + 1]] Reverse@ IntegerDigits[n, 2]); Array[ f, 107, 0]
  • PARI
    a(n) = my(s=0, u=1); for(k=0,#binary(n)-1,s+=bittest(n,k)*u;u=-u);s /* Washington Bomfim, Jan 18 2011 */
    
  • PARI
    a(n) = my(b=binary(n)); b*[(-1)^k|k<-[-#b+1..0]]~; \\ Ruud H.G. van Tol, Oct 16 2023
    
  • PARI
    a(n) = if(n==0, 0, 2*hammingweight(bitand(n, ((4<<(2*logint(n,4)))-1)/3)) - hammingweight(n)) \\ Andrew Howroyd, Dec 14 2024
    
  • Python
    def a(n):
        return sum((-1)**k for k, bi in enumerate(bin(n)[2:][::-1]) if bi=='1')
    print([a(n) for n in range(107)]) # Michael S. Branicky, Jul 13 2021
    
  • Python
    from sympy.ntheory import digits
    def A065359(n): return sum((0,1,-1,0)[i] for i in digits(n,4)[1:]) # Chai Wah Wu, Jul 19 2024

Formula

G.f.: (1/(1-x)) * Sum_{k>=0} (-1)^k*x^2^k/(1+x^2^k). - Ralf Stephan, Mar 07 2003
a(0) = 0, a(2n) = -a(n), a(2n+1) = 1-a(n). - Ralf Stephan, Mar 07 2003
a(n) = Sum_{k>=0} A030308(n,k)*(-1)^k. - Philippe Deléham, Oct 20 2011
a(n) = -a(floor(n/2)) + n mod 2. - Reinhard Zumkeller, Mar 20 2015
a(n) = A139351(n) - A139352(n). - Kevin Ryde, Jan 24 2020
G.f. A(x) satisfies: A(x) = x / (1 - x^2) - (1 + x) * A(x^2). - Ilya Gutkovskiy, Jul 28 2021
a(n) = A195017(A019565(n)). - Antti Karttunen, Jun 19 2024

Extensions

More terms from Ralf Stephan, Jul 12 2003

A059448 The parity of the number of zero digits when n is written in binary.

Original entry on oeis.org

0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1
Offset: 1

Views

Author

Henry Bottomley, Feb 02 2001

Keywords

Comments

Old name was: "If A_k are the terms from 2^(k-1) through to 2^k-1, then A_(k+1) is B_k A_k where B_k is A_k with 0's and 1's swapped, starting from a(1)=0; also parity of number of zero digits when n is written in binary. a(0) not given as it could be 1 or 0 depending on the definition or formula used." - Michel Dekking, Sep 11 2020
The sequence (when prefixed by 0) is overlap-free [Allouche and Shallit].
From Vladimir Shevelev, May 23 2017: (Start)
Theorem: The sequence is cubefree.
Here we show only that the sequence contains no three consecutive equal terms. Indeed, using the recursions below, we have
a(4*n)=a(n), a(4*n+1)=1-a(n), a(4*n+2)=1-a(n), a(4*n+3)=a(n), n >= 1, and our statement easily follows. In general, the Theorem could be proved either directly (cf. A269027) or using the remark below from Jeffrey Shallit and the well-known fact [first proved not later than 1912 by Axel Thue (private communication from Jean-Paul Allouche)] that the Thue-Morse sequence is cubefree.
Note that, by the formulas modulo 4, the sequence is constructed over four terms {a(4*n),a(4*n+1),a(4*n+2),a(4*n+3)} which, starting with a(4), are either {0,1,1,0} or {1,0,0,1}, the first elements of which form {a(n)}. (End)

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 26, Problem 23.

Crossrefs

Characteristic function of A059009.
Cf. A298952 (complement), A242179 (values +-1).

Programs

  • Haskell
    a059448 = (`mod` 2) . a023416  -- Reinhard Zumkeller, Mar 01 2012
    
  • Maple
    s1:=[];
    for n from 1 to 200 do
    t1:=convert(n,base,2); t2:=subs(1=NULL,t1); s1:=[op(s1),nops(t2) mod 2]; od:
    s1;
  • Mathematica
    Table[Boole[OddQ[Count[IntegerDigits[n, 2], 0]]], {n, 1, 105}] (* Jean-François Alcover, Apr 05 2013 *)
  • PARI
    a(n)=(#binary(n)-hammingweight(n))%2;
    vector(99,n,a(n)) /* Joerg Arndt, Sep 11 2020 */
    
  • Python
    def A059448(n): return (n.bit_length()^n.bit_count())&1 # Chai Wah Wu, Jul 26 2023

Formula

a(2n) = 1 - a(n); a(2n+1) = a(n) = 1 - a(2n). If 2^k <= n < 2^(k+1) then a(n) = 1 - a(n-2^(k-1)). a(n) = A023416(n) mod 2 = A059009(n) - 2n = 2n + 1 - A059010(n) = |A010060(n) - A030300(n-1)|.
Let b(1)=1 and b(n) = b(n-ceiling(n/2)) - b(n-floor(n/2)); then for n >= 1, a(n) = (1/2)*(1-b(2n+1)). - Benoit Cloitre, Apr 26 2005
Alternatively, if x is the sequence, then x = 010 mu^2(x), where mu is the Thue-Morse morphism sending 0 to 01 and 1 to 10. - Jeffrey Shallit, Jun 06 2016
a(n) = A010059(A054429(n)) = (1+A008836(A163511(n)))/2. - Antti Karttunen, May 30 2017
Alternatively, if x is the sequence, then x = 0 tau(x), where tau is the "twisted" Thue-Morse morphism sending 0 to 10 and 1 to 01. Note that tau^2 = mu^2, giving x = 010 mu^2(x). - Michel Dekking, Sep 30 2020

Extensions

Name changed by Michel Dekking, Sep 11 2020

A147991 Sequence S such that 1 is in S and if x is in S, then 3x-1 and 3x+1 are in S.

Original entry on oeis.org

1, 2, 4, 5, 7, 11, 13, 14, 16, 20, 22, 32, 34, 38, 40, 41, 43, 47, 49, 59, 61, 65, 67, 95, 97, 101, 103, 113, 115, 119, 121, 122, 124, 128, 130, 140, 142, 146, 148, 176, 178, 182, 184, 194, 196, 200, 202, 284, 286, 290, 292, 302, 304, 308, 310, 338, 340, 344, 346
Offset: 1

Views

Author

Clark Kimberling, Dec 07 2008

Keywords

Comments

Positive numbers that can be written in balanced ternary without a 0 trit. - J. Hufford, Jun 30 2015
Let S be the set of terms. Define c: Z -> P(R) so that c(m) is the translated Cantor ternary set spanning [m-0.5, m+0.5], and let C be the union of c(m) for all m in S U {0} U -S. C is the closure of the translated Cantor ternary set spanning [-0.5, 0.5] under multiplication by 3. - Peter Munn, Jan 31 2022

Examples

			0th generation: 1;
1st generation: 2 4;
2nd generation: 5 7 11 13.
		

Crossrefs

Cf. A006288, A351243 (non-quotients).
See also the related sequences listed in A191106.
One half of each position > 0 where A307744 sets or equals a record.
Cf. A030300.
Column k=3 of A360099.

Programs

  • Haskell
    import Data.Set (singleton, insert, deleteFindMin)
    a147991 n = a147991_list !! (n-1)
    a147991_list = f $ singleton 1 where
       f s = m : (f $ insert (3*m - 1) $ insert (3*m + 1) s')
             where (m, s') = deleteFindMin s
    -- Reinhard Zumkeller, Feb 21 2012, Jan 23 2011
    
  • Maple
    A147991:= proc(n) option remember; if n::even then 3*procname(n/2)-1 else 3*procname((n-1)/2)+1 fi end proc:
    A147991(1):= 1:
    [seq](A147991(i),i=1..1000); # Robert Israel, May 05 2014
  • Mathematica
    nn=346; s={1}; While[s1=Select[Union[s, 3*s-1, 3*s+1], # <= nn &];  s != s1, s=s1]; s
    a[ n_] := If[ n < -1 || n > 0, 3 a[Quotient[n, 2]] - (-1)^Mod[n, 2], 0]; (* Michael Somos, Dec 22 2018 *)
  • PARI
    {a(n) = if( n<-1 || n>0, 3*a(n\2) - (-1)^(n%2), 0)}; /* Michael Somos, Dec 22 2018 */
    
  • PARI
    a(n) = fromdigits(apply(b->if(b,1,-1),binary(n)), 3); \\ Kevin Ryde, Feb 06 2022

Formula

a(n) = 3*a(n/2) - 1 if n>=2 is even, 3*a((n-1)/2) + 1 if n is odd, a(0)=0. - Robert Israel, May 05 2014
G.f. g(x) satisfies g(x) = 3*(x+1)*g(x^2) + x/(1+x). - Robert Israel, May 05 2014
Product_{j=0..n-1} cos(3^j) = 2^(-n+1)*Sum_{i=2^(n-1)..2^n-1} cos(a(i)). - Gevorg Hmayakyan, Jan 15 2017
Sum_{i=2^(n-1)..2^n-1} cos(a(i)/3^(n-1)*Pi/2) = 0. - Gevorg Hmayakyan, Jan 15 2017
a(n) = -a(-1-n) for all n in Z. - Michael Somos, Dec 22 2018
For n > 0, A307744(2*a(2n)) = A307744(2*a(2n+1)) = A307744(2*a(n)) + 1. - Peter Munn, Jan 31 2022
a(n) mod 2 = A030300(n). - Alois P. Heinz, Jan 29 2023

A360099 To get A(n,k), replace 0's in the binary expansion of n with (-1) and interpret the result in base k; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

0, 0, 1, 0, 1, -1, 0, 1, 0, 1, 0, 1, 1, 2, -1, 0, 1, 2, 3, -1, 1, 0, 1, 3, 4, 1, 1, -1, 0, 1, 4, 5, 5, 3, 1, 1, 0, 1, 5, 6, 11, 7, 5, 3, -1, 0, 1, 6, 7, 19, 13, 11, 7, -2, 1, 0, 1, 7, 8, 29, 21, 19, 13, 1, 0, -1, 0, 1, 8, 9, 41, 31, 29, 21, 14, 3, 0, 1, 0, 1, 9, 10, 55, 43, 41, 31, 43, 16, 5, 2, -1
Offset: 0

Views

Author

Alois P. Heinz, Jan 25 2023

Keywords

Comments

The empty bit string is used as binary expansion of 0, so A(0,k) = 0.

Examples

			Square array A(n,k) begins:
   0,  0, 0,  0,  0,   0,   0,   0,   0,   0,   0, ...
   1,  1, 1,  1,  1,   1,   1,   1,   1,   1,   1, ...
  -1,  0, 1,  2,  3,   4,   5,   6,   7,   8,   9, ...
   1,  2, 3,  4,  5,   6,   7,   8,   9,  10,  11, ...
  -1, -1, 1,  5, 11,  19,  29,  41,  55,  71,  89, ...
   1,  1, 3,  7, 13,  21,  31,  43,  57,  73,  91, ...
  -1,  1, 5, 11, 19,  29,  41,  55,  71,  89, 109, ...
   1,  3, 7, 13, 21,  31,  43,  57,  73,  91, 111, ...
  -1, -2, 1, 14, 43,  94, 173, 286, 439, 638, 889, ...
   1,  0, 3, 16, 45,  96, 175, 288, 441, 640, 891, ...
  -1,  0, 5, 20, 51, 104, 185, 300, 455, 656, 909, ...
		

Crossrefs

Columns k=0-6, 10 give: A062157, A145037, A006257, A147991, A147992, A153777, A147993, A359925.
Rows n=0-10 give: A000004, A000012, A023443, A000027(k+1), A165900, A002061, A165900(k+1), A002061(k+1), A083074, A152618, A062158.
Main diagonal gives A360096.

Programs

  • Maple
    A:= proc(n, k) option remember; local m;
         `if`(n=0, 0, k*A(iquo(n, 2, 'm'), k)+2*m-1)
        end:
    seq(seq(A(n, d-n), n=0..d), d=0..12);
    # second Maple program:
    A:= (n, k)-> (l-> add((2*l[i]-1)*k^(i-1), i=1..nops(l)))(Bits[Split](n)):
    seq(seq(A(n, d-n), n=0..d), d=0..12);

Formula

G.f. for column k satisfies g_k(x) = k*(x+1)*g_k(x^2) + x/(1+x).
A(n,k) = k*A(floor(n/2),k)+2*(n mod 2)-1 for n>0, A(0,k)=0.
A(n,k) mod 2 = A057427(n) if k is even.
A(n,k) mod 2 = A030300(n) if k is odd and n>=1.
A(2^(n+1),1) + n = 0.

A030301 n-th run has length 2^(n-1).

Original entry on oeis.org

0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A030300. Partial sums give A079954.
Characteristic function of A053754 (after its initial 0).

Programs

  • Magma
    [Floor(Log(n)/Log(2)) mod 2: n in [1..100]]; // Vincenzo Librandi, Jun 23 2015
    
  • Mathematica
    nMax = 7; Table[1 - Mod[n, 2], {n, nMax}, {2^(n-1)}] // Flatten (* Jean-François Alcover, Oct 20 2016 *)
    Table[{PadRight[{},2^(n-1),0],PadRight[{},2^n,1]},{n,1,8,2}]//Flatten (* Harvey P. Dale, Apr 12 2023 *)
  • PARI
    a(n)=if(n<1,0,1-length(binary(n))%2)
    
  • PARI
    a(n)=if(n<1,0,if(n%2==0,-a(n/2)+1,-a((n-1)/2)+1-(((n-1)/2)==0))) /* Ralf Stephan */
    
  • Python
    def A030301(n): return n.bit_length()&1^1 # Chai Wah Wu, Jan 30 2023

Formula

a(n) = A000523(n) mod 2 = (A029837(n+1)+1) mod 2.
a(n) = 0 iff n has an odd number of digits in binary, = 1 otherwise. - Henry Bottomley, Apr 06 2000
a(n) = (1/2)*{1-(-1)^floor(log(n)/log(2))}. - Benoit Cloitre, Nov 22 2001
a(n) = 1-a(floor(n/2)). - Vladeta Jovovic, Aug 04 2003
a(n) = 1 - A030300(n). - Antti Karttunen, Oct 10 2017

A160386 Decimal expansion of Sum_{n>=0}(-1)^n/3^(2^n).

Original entry on oeis.org

2, 3, 4, 4, 1, 5, 5, 0, 8, 6, 7, 4, 8, 6, 4, 6, 1, 4, 4, 1, 3, 4, 1, 5, 4, 7, 4, 3, 4, 5, 6, 0, 4, 5, 9, 7, 6, 1, 4, 7, 2, 4, 5, 6, 3, 9, 0, 6, 6, 9, 3, 0, 2, 7, 6, 7, 9, 4, 2, 7, 7, 3, 7, 0, 9, 8, 3, 8, 1, 4, 3, 1, 5, 1, 3, 7, 5, 8, 5, 3, 5, 3, 1, 0, 3, 7, 5, 6, 5, 6, 5, 9, 8, 4, 9, 7, 6, 5, 9, 8, 4, 4, 0, 6, 4
Offset: 0

Views

Author

Harry J. Smith, May 12 2009

Keywords

Comments

This sum is among forms which Kempner showed are transcendental. - Kevin Ryde, Sep 16 2019

Examples

			0.234415508674864614413415474345604597614724563906693027679427737098381...
		

Crossrefs

Cf. A006467 (continued fraction), A030300 (ternary expansion).

Programs

  • Mathematica
    RealDigits[N[Sum[(-1)^n/3^(2^n), {n, 0, Infinity}], 120]][[1]] (* Amiram Eldar, Jun 11 2023 *)
  • PARI
    { default(realprecision, 20080); x=10*suminf(n=0, (-1)^n/3^(2^n)); for (n=0, 20000, d=floor(x); x=(x-d)*10; write("b160386.txt", n, " ", d)); }

A153777 Sequence S such that 1 is in S and if x is in S, then 5x-1 and 5x+1 are in S.

Original entry on oeis.org

1, 4, 6, 19, 21, 29, 31, 94, 96, 104, 106, 144, 146, 154, 156, 469, 471, 479, 481, 519, 521, 529, 531, 719, 721, 729, 731, 769, 771, 779, 781, 2344, 2346, 2354, 2356, 2394, 2396, 2404, 2406, 2594, 2596, 2604, 2606, 2644, 2646, 2654, 2656, 3594, 3596, 3604
Offset: 1

Views

Author

Clark Kimberling, Jan 02 2009

Keywords

Comments

Subsequences include A003463, A083065.
1st generation: 1
2nd generation: 4, 6
3rd generation: 19, 21, 29, 31
4th generation: 94, 96, 104, 106, 144, 146, 154, 156
Does every generation contain p or 2p for some prime p?

Crossrefs

Column k=5 of A360099.

Programs

  • Mathematica
    nxt[n_]:=Flatten[5#+{1,-1}&/@n]; Union[Flatten[NestList[nxt,{1},5]]] (* Harvey P. Dale, Dec 25 2012 *)

Formula

Product_{j=0..n-1} cos(5^j) = 2^(-n+1)*Sum_{i=2^(n-1)..2^n-1} cos(a(i)). - Gevorg Hmayakyan, Jan 15 2017
Sum_{i=2^(n-1)..2^n-1} cos(a(i)/5^(n-1)*Pi/2) = 0. - Gevorg Hmayakyan, Jan 15 2017
a(n) mod 2 = A030300(n). - Alois P. Heinz, Jan 29 2023
Showing 1-10 of 15 results. Next