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-3 of 3 results.

A194678 Number of k in [1,n] for which + > 1, where < > = fractional part; row sums of A164677.

Original entry on oeis.org

1, 1, 0, 4, 4, 2, 0, 6, 4, 1, 10, 8, 4, 0, 11, 7, 2, 16, 12, 7, 1, 17, 12, 5, 24, 18, 11, 3, 24, 17, 8, 32, 24, 15, 5, 31, 22, 11, 0, 29, 18, 6, 38, 27, 14, 1, 35, 22, 8, 45, 32, 17, 2, 41, 27, 11, 53, 38, 22, 5, 49, 33, 15, 62, 45, 27, 8, 57, 39, 19, 71, 52, 32, 11, 66, 46
Offset: 1

Views

Author

Clark Kimberling, Sep 01 2011

Keywords

Crossrefs

Cf. A194677.

Programs

  • Mathematica
    r = E; z = 15;
    p[x_] := FractionalPart[x]; f[x_] := Floor[x];
    w[n_, k_] := p[r^n] + p[r^k] - p[r^n + r^k]
    Flatten[Table[w[n, k], {n, 1, z}, {k, 1, n}]]
    (* A194675 *)
    TableForm[Table[w[n, k], {n, 1, z}, {k, 1, n}]]
    s[n_] := Sum[w[n, k], {k, 1, n}]  (* A194676 *)
    Table[s[n], {n, 1, 100}]
    h[n_, k_] := f[p[n*r] + p[k*r]]
    Flatten[Table[h[n, k], {n, 1, z}, {k, 1, n}]]
     (* A194677 *)
    TableForm[Table[h[n, k], {n, 1, z}, {k, 1, n}]]
    t[n_] := Sum[h[n, k], {k, 1, n}]
    Table[t[n], {n, 1, 100}]  (* A194678 *)

A091067 Numbers whose odd part is of the form 4k+3.

Original entry on oeis.org

3, 6, 7, 11, 12, 14, 15, 19, 22, 23, 24, 27, 28, 30, 31, 35, 38, 39, 43, 44, 46, 47, 48, 51, 54, 55, 56, 59, 60, 62, 63, 67, 70, 71, 75, 76, 78, 79, 83, 86, 87, 88, 91, 92, 94, 95, 96, 99, 102, 103, 107, 108, 110, 111, 112, 115, 118, 119, 120, 123, 124, 126, 127, 131
Offset: 1

Views

Author

Ralf Stephan, Feb 22 2004

Keywords

Comments

Either of form 2*a(m) or 4k+3, k >= 0, 0 < m < n.
A000265(a(n)) is an element of A004767.
a(n) such that A038189(a(n)) = 1.
Numbers n such that Kronecker(-n, m) = Kronecker(m, n) for all m. - Michael Somos, Sep 22 2005
From Antti Karttunen, Feb 20-21 2015: (Start)
Gives all n for which A005811(n) - A005811(n-1) = -1, from which follows that a(n) = the least k such that A255070(k) = n.
Gives the positions of even terms in A003602. (End)
Indices of negative terms in A164677. - M. F. Hasler, Aug 06 2015
Indices of the 0's in A014577. - Gabriele Fici, Jun 02 2016
Also indices of -1 in A034947. - Jianing Song, Apr 24 2021
Conjecture: alternate definition of same sequence is that a(1)=3 and a(n) is the smallest number > a(n-1) so that no number that is the sum of at most 2 terms in this sequence is a power of 2. - J. Lowell, Jan 20 2024
The asymptotic density of this sequence is 1/2. - Amiram Eldar, Aug 31 2024

Crossrefs

Essentially one less than A060833.
Characteristic function: A038189.
Complement of A091072.
First differences are in A106836 (from its second term onward).
Sequence A246590 gives the even terms.
Gives the positions of records (after zero) for A255070 (equally, the position of the first n there).
Cf. A106837 (gives n such that both n and n+1 are terms of this sequence).
Cf. A098502 (gives n such that both n and n+2 are, but n+1 is not in this sequence).

Programs

  • Haskell
    import Data.List (elemIndices)
    a091067 n = a091067_list !! (n-1)
    a091067_list = map (+ 1) $ elemIndices 1 a014707_list
    -- Reinhard Zumkeller, Sep 28 2011
    (Scheme, with Antti Karttunen's IntSeq-library, two versions)
    (define A091067 (MATCHING-POS 1 1 (COMPOSE even? A003602)))
    (define A091067 (NONZERO-POS 1 0 A038189))
    ;; Antti Karttunen, Feb 20 2015
  • Mathematica
    Select[Range[150], Mod[# / 2^IntegerExponent[#, 2], 4] == 3 &] (* Amiram Eldar, Aug 31 2024 *)
  • PARI
    for(n=1,200,if(((n/2^valuation(n,2)-1)/2)%2,print1(n",")))
    
  • PARI
    {a(n) = local(m, c); if( n<1, 0, c=0; m=1; while( cMichael Somos, Sep 22 2005 */
    
  • PARI
    is_A091067(n)=bittest(n,valuation(n,2)+1) \\ M. F. Hasler, Aug 06 2015
    
  • PARI
    a(n) = my(t=1); n<<=1; forstep(i=logint(n,2),0,-1, if(bittest(n,i)==t, n++;t=!t)); n; \\ Kevin Ryde, Mar 21 2021
    

Formula

a(n) = A060833(n+1) - 1. [See N. Sato's Feb 12 2013 comment in A060833.]
Other identities. For all n >= 1 it holds that:
A014707(a(n) + 1) = 1. - Reinhard Zumkeller, Sep 28 2011
A055975(a(n)) < 0. - Reinhard Zumkeller, Apr 28 2012
From Antti Karttunen, Feb 20-21 2015: (Start)
a(n) = A246590(n)/2.
A255070(a(n)) = n, or equally, A236840(a(n)) = 2n.
a(n) = 1 + A255068(n-1). (End)

A038189 Bit to left of least significant 1-bit in binary expansion of n.

Original entry on oeis.org

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

Views

Author

Fred Lunnon, Dec 11 1999

Keywords

Comments

Characteristic function of A091067.
Image, under the coding i -> floor(i/2), of the fixed point, starting with 0, of the morphism 0 -> 01, 1 -> 02, 2 -> 32, 3 -> 31. - Jeffrey Shallit, May 15 2016
Restricted to the positive integers, completely additive modulo 2. - Peter Munn, Jun 20 2022
If a(n) is defined as 1-a(-n) for all n<0, then a(n) = a(2*n), a(4*n+1) = 0, a(4*n+3) = 1 for all n in Z. - Michael Somos, Oct 05 2024

Examples

			a(6) = 1 since 6 = 110 and bit before rightmost 1 is a 1.
		

References

  • Jean-Paul Allouche and Jeffrey O. Shallit, Automatic sequences, Cambridge, 2003, sect. 5.1.6

Crossrefs

A014707(n)=a(n+1). A014577(n)=1-a(n+1).
The following are all essentially the same sequence: A014577, A014707, A014709, A014710, A034947, A038189, A082410. - N. J. A. Sloane, Jul 27 2012
Related sequences A301848, A301849, A301850. - Fred Lunnon, Mar 27 2018

Programs

  • C
    int a(int n) { return (n & ((n&-n)<<1)) ? 1 : 0; } /* from Russ Cox */
    
  • Magma
    function a (n)
      if n eq 0 then return 0; // alternatively,  return 1;
      else while IsEven(n) do n := n div 2; end while; end if;
      return n div 2 mod 2; end function;
      nlo := 0; nhi := 32;
      [a(n) : n in [nlo..nhi] ]; //  Fred Lunnon, Mar 27 2018
    
  • Maple
    A038189 := proc(n)
        option remember;
        if n = 0 then
            0 ;
        elif type(n,'even') then
            procname(n/2) ;
        elif modp(n,4) = 1 then
            0 ;
        else
            1 ;
        end if;
    end proc:
    seq(A038189(n),n=0..100) ; # R. J. Mathar, Mar 30 2018
  • Mathematica
    f[n_] := Block[{id2 = Join[{0}, IntegerDigits[n, 2]]}, While[ id2[[-1]] == 0, id2 = Most@ id2]; id2[[-2]]]; f[0] = 0; Array[f, 105, 0] (* Robert G. Wilson v, Apr 14 2009 and fixed Feb 27 2014 *)
    f[n_] := f[n] = Switch[Mod[n, 4], 0, f[n/2], 1, 0, 2, f[n/2], 3, 1]; f[0] = 0; Array[f, 105, 0] (* Robert G. Wilson v, Apr 14 2009, fixed Feb 27 2014 *)
    a[ n_] := If[n==0, 0, Mod[(n/2^IntegerExponent[n, 2]-1)/2, 2]]; (* Michael Somos, Oct 05 2024 *)
  • PARI
    {a(n) = if(n==0, 0, ((n/2^valuation(n,2)-1)/2)%2)}; /* Michael Somos, Sep 22 2005 */
    
  • PARI
    a(n) = if(n<3, 0, prod(m=1,n, kronecker(-n,m)==kronecker(m,n))) /* Michael Somos, Sep 22 2005 */
    
  • PARI
    A038189(n)=bittest(n,valuation(n,2)+1) \\ M. F. Hasler, Aug 06 2015
    
  • PARI
    a(n)=my(h=bitand(n,-n));n=bitand(n,h<<1);n!=0; \\ Joerg Arndt, Apr 09 2021
    
  • Python
    def A038189(n):
        s = bin(n)[2:]
        m = len(s)
        i = s[::-1].find('1')
        return int(s[m-i-2]) if m-i-2 >= 0 else 0 # Chai Wah Wu, Apr 08 2021
    
  • Python
    def a(n): return 1 if (n & ((n&-n)<<1)) else 0
    print([a(n) for n in range(108)]) # Michael S. Branicky, Feb 06 2025 after Russ Cox

Formula

a(0) = 0, a(2*n) = a(n) for n>0, a(4*n+1) = 0, a(4*n+3) = 1.
G.f.: Sum_{k>=0} t^3/(1-t^4), where t=x^2^k. Parity of A025480. For n >= 1, a(n) = 1/2 * (1 - (-1)^A025480(n-1)). - Ralf Stephan, Jan 04 2004 [index adjusted by Peter Munn, Jun 22 2022]
a(n) = 1 if Kronecker(-n,m)=Kronecker(m,n) for all m, otherwise a(n)=0. - Michael Somos, Sep 22 2005
a(n) = 1 iff A164677(n) < 0. - M. F. Hasler, Aug 06 2015
For n >= 1, a(n) = A065339(n) mod 2. - Peter Munn, Jun 20 2022
From A.H.M. Smeets, Mar 08 2023: (Start)
a(n+1) = 1 - A014577(n) for n >= 0.
a(n+1) = 2 - A014710(n) for n >= 0.
a(n) = (1 - A034947(n))/2 for n > 0. (End)
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/2. - Amiram Eldar, Aug 30 2024

Extensions

More terms from David W. Wilson
Definition corrected by Russ Cox and Ralf Stephan, Nov 08 2004
Showing 1-3 of 3 results.