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 10 results.

A144916 Integers k for which |A144912| attains a new maximal odd value.

Original entry on oeis.org

4, 7, 16, 36, 64, 100, 144, 196, 256, 324, 400, 484, 576, 676, 784, 900, 1024, 1156, 1296, 1444, 1600, 1764, 1936, 2116, 2304, 2500, 2704, 2916, 3136, 3364, 3600, 3844, 4096, 4356, 4624, 4900, 5184, 5476, 5776, 6084, 6400, 6724, 7056, 7396, 7744, 8100
Offset: 1

Views

Author

Reikku Kulon, Sep 25 2008

Keywords

Comments

Except for 7, all of these are even squares (A016742). For 7, the new maximum occurs in base 2 and for the rest it occurs in base sqrt(n).

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{3,-3,1},{4,7,16,36,64},100] (* Paolo Xausa, Sep 26 2023 *)
  • PARI
    a(n) = if(n>2, 4*(n-1)^2, 1+3*n); \\ Jinyuan Wang, Jul 21 2020

A144923 Triangle read by rows: |A144912(b, b^2 + k)| if it is prime and 0 otherwise, with rows b in {2, 4, 6, ...} and columns k in {0, 1, 3, 4, 6, 7, ..., b}.

Original entry on oeis.org

0, 0, 7, 5, 0, 5, 13, 11, 7, 5, 11, 19, 17, 13, 11, 7, 5, 0, 23, 19, 17, 13, 11, 7, 23, 31, 29, 0, 23, 19, 17, 13, 11, 29, 37, 0, 31, 29, 0, 23, 19, 17, 13, 11, 43, 41, 37, 0, 31, 29, 0, 23, 19, 17, 13, 41, 0, 47, 43, 41, 37, 0, 31, 29, 0, 23, 19, 17, 47
Offset: 2

Views

Author

Reikku Kulon, Sep 25 2008

Keywords

Comments

This triangle is roughly twice the usual width. Odd rows and columns congruent to 2 modulo 3 are omitted; otherwise the triangle would begin like this:
2:..0...0...0
3:..0...2...0...2
4:..7...5...3...0...5
5:..0...0...0...0...2...0
6:.13..11...0...7...5...3..11
7:..0...0...0...0...0...0...0...0
8:.19..17...0..13..11...0...7...5..17
Every odd row afterward would then be entirely filled with zeros and every third column would contain zeros, often following an initial prime.
The triangle begins as follows:
b
--+b^2..+0..+1..+3..+4..+6..+7..+9.+10.+12
2.:......0...0
4.:......7...5...0...5
6.:.....13..11...7...5..11
8.:.....19..17..13..11...7...5
10:......0..23..19..17..13..11...7..23
12:.....31..29...0..23..19..17..13..11..29
Some diagonals are entirely filled with zeros; for example, the first such diagonal begins at b = 32 and there is another for b in [40, 42].
The fraction |A144912(b, b^2)| / b approaches 3 or nearly 3.
For n = b and m = b + 2, ((n, x) + (m, x)) / 2 approximates (m, x + 1) = (n, x - 1), where x is the index of a column disregarding k.
The units digit in columns follows the repeating sequence {1, 7, 3, 9, 5}, with nearly all fives omitted and occasional other omissions.
The units digit in rows follows the sequence {1, 9, 5, 3, 9, 7, 3, 1, 7, 5}.
The complete repeating unit is:
1 9 5 3 9 7 3 1 7 5
7 5 1 9 5 3 9 7 3 1
3 1 7 5 1 9 5 3 9 7
9 7 3 1 7 5 1 9 5 3
5 3 9 7 3 1 7 5 1 9

Crossrefs

Programs

  • PARI
    T(b, k) = {my(d=digits(k, b)); if(isprime(d=abs(sum(i=1, #d, 2*d[i]-b+1))), d, 0); }
    row(n) = {my(v=[]); for(k=0, 2*n, if(k%3<2, v=concat(v, T(2*n, 4*n^2+k)))); v; } \\ Jinyuan Wang, Jul 21 2020

A145009 Array read by antidiagonals: array of odd integers found in |A144912| with axes b = {4, 6, 8, ...} and n = {b^2, b^4, b^6, ...}.

Original entry on oeis.org

7, 13, 13, 19, 23, 19, 25, 33, 33, 25, 31, 43, 47, 43, 31, 37, 53, 61, 61, 53, 37, 43, 63, 75, 79, 75, 63, 43, 49, 73, 89, 97, 97, 89, 73, 49, 55, 83, 103, 115, 119, 115, 103, 83, 55, 61, 93, 117, 133, 141, 141, 133, 117, 93, 61
Offset: 0

Views

Author

Reikku Kulon, Sep 28 2008

Keywords

Comments

The complete array can be defined as 6(x + y) + 4xy + 7.
Values along the edges are given by 6x + 7 and thus include the larger member of every twin prime pair except 5. The smaller member, 6x + 5, is adjacent in |A144912|.
Taking the origin to be z = 1, the main diagonal is given by 4z^2 + 4z - 1 (A073577).
Sums along antidiagonals are given by z(2z^2 + 12z + 7) / 3.
From Reikku Kulon, Sep 29 2008: (Start)
Any entry in the triangle can be produced from the two terms diagonally above or below and the edges can be found by taking the odd numbers as the "missing" values, starting from 1. If the terms are denoted:
.. a0 .. ...
a1 .. a2 ...
.. a3 .. ...
then:
a0 = (a1 + a2)/2 - 4*(a1 + a2 + 4)/(a2 - a1);
a3 = (a1 + a2)/2 + 4*(a1 + a2 + 4)/(a2 - a1). [Corrected by Jinyuan Wang, Jul 29 2020]
(End)

Examples

			Array A(n,k) begins:
7,  13, 19, 25,  31,  37,  43,  ...
13, 23, 33, 43,  53,  63,  73,  ...
19, 33, 47, 61,  75,  89,  103, ...
25, 43, 61, 79,  97,  115, 133, ...
31, 53, 75, 97,  119, 141, 163, ...
37, 63, 89, 115, 141, 167, 193, ...
...
		

Crossrefs

Formula

A(n, k) = |A144912(2*n+4, (2*n+4)^(2*k+2))| = 6*(n+k) + 4*n*k + 7.

A144948 The band of primes in rows of A144912 interpreted as binary numbers, with primes as ones, composites and two as zeros and ignoring odd bases, taking the least significant bit from base two.

Original entry on oeis.org

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

Views

Author

Reikku Kulon, Sep 26 2008

Keywords

A145731 Conjectured integers m such that |A144912(2, p^m)| > 0 for all Mersenne prime exponents p > 7.

Original entry on oeis.org

4, 10, 19, 23, 24, 25, 27, 28, 30, 31, 32, 33, 34, 42, 48, 51, 52, 53, 55, 59, 60, 61, 62, 68, 69, 71, 72, 74, 75, 76, 77, 78, 80, 81, 82, 84, 85, 86, 91, 92, 93, 95, 96, 98, 99, 100, 101, 102, 103, 104, 105, 106, 109, 110, 112, 113, 115, 116, 117, 118, 119, 120, 121
Offset: 1

Views

Author

Reikku Kulon, Oct 17 2008

Keywords

Comments

An integer m is excluded from the sequence iff A144912(2, p^m) = 0 for some Mersenne prime exponent p > 7.
The given terms are sufficient to identify the Mersenne prime exponents 13, 17, 19 and 31 without error, followed by the incorrect 41 and 59, correct 61, incorrect 71 and correct 89. Additional terms quickly reduce the number of false positives such that, for example, the first thirty Mersenne primes can be identified within minutes using unexceptional software and hardware and, in particular, without primality testing of integers larger than 132049.
Noting that A144912(2, k) is a function of k in base 2, it is expected that extremely efficient methods can be found for producing Mersenne primes and perfect numbers within seconds.

Crossrefs

Extensions

Name changed and incorrect term 79 removed by Jinyuan Wang, Jul 29 2020

A000396 Perfect numbers k: k is equal to the sum of the proper divisors of k.

Original entry on oeis.org

6, 28, 496, 8128, 33550336, 8589869056, 137438691328, 2305843008139952128, 2658455991569831744654692615953842176, 191561942608236107294793378084303638130997321548169216
Offset: 1

Views

Author

Keywords

Comments

A number k is abundant if sigma(k) > 2k (cf. A005101), perfect if sigma(k) = 2k (this sequence), or deficient if sigma(k) < 2k (cf. A005100), where sigma(k) is the sum of the divisors of k (A000203).
The numbers 2^(p-1)*(2^p - 1) are perfect, where p is a prime such that 2^p - 1 is also prime (for the list of p's see A000043). There are no other even perfect numbers and it is believed that there are no odd perfect numbers.
Numbers k such that Sum_{d|k} 1/d = 2. - Benoit Cloitre, Apr 07 2002
For number of divisors of a(n) see A061645(n). Number of digits in a(n) is A061193(n). - Lekraj Beedassy, Jun 04 2004
All terms other than the first have digital root 1 (since 4^2 == 4 (mod 6), we have, by induction, 4^k == 4 (mod 6), or 2*2^(2*k) = 8 == 2 (mod 6), implying that Mersenne primes M = 2^p - 1, for odd p, are of the form 6*t+1). Thus perfect numbers N, being M-th triangular, have the form (6*t+1)*(3*t+1), whence the property N mod 9 = 1 for all N after the first. - Lekraj Beedassy, Aug 21 2004
The earliest recorded mention of this sequence is in Euclid's Elements, IX 36, about 300 BC. - Artur Jasinski, Jan 25 2006
Theorem (Euclid, Euler). An even number m is a perfect number if and only if m = 2^(k-1)*(2^k-1), where 2^k-1 is prime. Euler's idea came from Euclid's Proposition 36 of Book IX (see Weil). It follows that every even perfect number is also a triangular number. - Mohammad K. Azarian, Apr 16 2008
Triangular numbers (also generalized hexagonal numbers) A000217 whose indices are Mersenne primes A000668, assuming there are no odd perfect numbers. - Omar E. Pol, May 09 2008, Sep 15 2013
If a(n) is even, then 2*a(n) is in A181595. - Vladimir Shevelev, Nov 07 2010
Except for a(1) = 6, all even terms are of the form 30*k - 2 or 45*k + 1. - Arkadiusz Wesolowski, Mar 11 2012
a(4) = A229381(1) = 8128 is the "Simpsons's perfect number". - Jonathan Sondow, Jan 02 2015
Theorem (Farideh Firoozbakht): If m is an integer and both p and p^k-m-1 are prime numbers then x = p^(k-1)*(p^k-m-1) is a solution to the equation sigma(x) = (p*x+m)/(p-1). For example, if we take m=0 and p=2 we get Euclid's result about perfect numbers. - Farideh Firoozbakht, Mar 01 2015
The cototient of the even perfect numbers is a square; in particular, if 2^p - 1 is a Mersenne prime, cototient(2^(p-1) * (2^p - 1)) = (2^(p-1))^2 (see A152921). So, this sequence is a subsequence of A063752. - Bernard Schott, Jan 11 2019
Euler's (1747) proof that all the even perfect number are of the form 2^(p-1)*(2^p-1) implies that their asymptotic density is 0. Kanold (1954) proved that the asymptotic density of odd perfect numbers is 0. - Amiram Eldar, Feb 13 2021
If k is perfect and semiprime, then k = 6. - Alexandra Hercilia Pereira Silva, Aug 30 2021
This sequence lists the fixed points of A001065. - Alois P. Heinz, Mar 10 2024

Examples

			6 is perfect because 6 = 1+2+3, the sum of all divisors of 6 less than 6; 28 is perfect because 28 = 1+2+4+7+14.
		

References

  • Tom M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, page 4.
  • Albert H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 2d ed. 1966, pp. 11-23.
  • Stanley J. Bezuszka, Perfect Numbers (Booklet 3, Motivated Math. Project Activities), Boston College Press, Chestnut Hill MA, 1980.
  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See pp. 136-137.
  • Euclid, Elements, Book IX, Section 36, about 300 BC.
  • Jan Gullberg, Mathematics from the Birth of Numbers, W. W. Norton & Co., NY & London, 1997, §3.3 Perfect and Amicable Numbers, pp. 82-83.
  • R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section B1.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 239.
  • T. Koshy, "The Ends Of A Mersenne Prime And An Even Perfect Number", Journal of Recreational Mathematics, Baywood, NY, 1998, pp. 196-202.
  • Joseph S. Madachy, Madachy's Mathematical Recreations, New York: Dover Publications, Inc., 1979, p. 149 (First publ. by Charles Scribner's Sons, New York, 1966, under the title: Mathematics on Vacation).
  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, pages 46-48, 244-245.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See pp. 83-87.
  • József Sándor and Borislav Crstici, Handbook of Number Theory, II, Springer Verlag, 2004.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Ian Stewart, L'univers des nombres, "Diviser Pour Régner", Chapter 14, pp. 74-81, Belin-Pour La Science, Paris, 2000.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, chapter 4, pages 127-149.
  • Horace S. Uhler, On the 16th and 17th perfect numbers, Scripta Math., Vol. 19 (1953), pp. 128-131.
  • André Weil, Number Theory, An approach through history, From Hammurapi to Legendre, Birkhäuser, 1984, p. 6.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, pp. 107-110, Penguin Books, 1987.

Crossrefs

See A000043 for the current state of knowledge about Mersenne primes.
Cf. A228058 for Euler's criterion for odd terms.
Positions of 0's in A033879 and in A033880.
Cf. A001065.

Programs

  • Haskell
    a000396 n = a000396_list !! (n-1)
    a000396_list = [x | x <- [1..], a000203 x == 2 * x]
    -- Reinhard Zumkeller, Jan 20 2012
    
  • Mathematica
    Select[Range[9000], DivisorSigma[1,#]== 2*# &] (* G. C. Greubel, Oct 03 2017 *)
    PerfectNumber[Range[15]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Dec 10 2018 *)
  • PARI
    isA000396(n) = (sigma(n) == 2*n);
    
  • Python
    from sympy import divisor_sigma
    def ok(n): return n > 0 and divisor_sigma(n) == 2*n
    print([k for k in range(9999) if ok(k)]) # Michael S. Branicky, Mar 12 2022

Formula

The perfect number N = 2^(p-1)*(2^p - 1) is also multiplicatively p-perfect (i.e., A007955(N) = N^p), since tau(N) = 2*p. - Lekraj Beedassy, Sep 21 2004
a(n) = 2^A133033(n) - 2^A090748(n), assuming there are no odd perfect numbers. - Omar E. Pol, Feb 28 2008
a(n) = A000668(n)*(A000668(n)+1)/2, assuming there are no odd perfect numbers. - Omar E. Pol, Apr 23 2008
a(n) = A000217(A000668(n)), assuming there are no odd perfect numbers. - Omar E. Pol, May 09 2008
a(n) = Sum of the first A000668(n) positive integers, assuming there are no odd perfect numbers. - Omar E. Pol, May 09 2008
a(n) = A000384(A019279(n)), assuming there are no odd perfect numbers and no odd superperfect numbers. a(n) = A000384(A061652(n)), assuming there are no odd perfect numbers. - Omar E. Pol, Aug 17 2008
a(n) = A006516(A000043(n)), assuming there are no odd perfect numbers. - Omar E. Pol, Aug 30 2008
From Reikku Kulon, Oct 14 2008: (Start)
A144912(2, a(n)) = 1;
A144912(4, a(n)) = -1 for n > 1;
A144912(8, a(n)) = 5 or -5 for all n except 2;
A144912(16, a(n)) = -4 or -13 for n > 1. (End)
a(n) = A019279(n)*A000668(n), assuming there are no odd perfect numbers and odd superperfect numbers. a(n) = A061652(n)*A000668(n), assuming there are no odd perfect numbers. - Omar E. Pol, Jan 09 2009
a(n) = A007691(A153800(n)), assuming there are no odd perfect numbers. - Omar E. Pol, Jan 14 2009
Even perfect numbers N = K*A000203(K), where K = A019279(n) = 2^(p-1), A000203(A019279(n)) = A000668(n) = 2^p - 1 = M(p), p = A000043(n). - Lekraj Beedassy, May 02 2009
a(n) = A060286(A016027(n)), assuming there are no odd perfect numbers. - Omar E. Pol, Dec 13 2012
For n >= 2, a(n) = Sum_{k=1..A065549(n)} (2*k-1)^3, assuming there are no odd perfect numbers. - Derek Orr, Sep 28 2013
a(n) = A275496(2^((A000043(n) - 1)/2)) - 2^A000043(n), assuming there are no odd perfect numbers. - Daniel Poveda Parrilla, Aug 16 2016
a(n) = A156552(A324201(n)), assuming there are no odd perfect numbers. - Antti Karttunen, Mar 28 2019
a(n) = ((2^(A000043(n)))^3 - (2^(A000043(n)) - 1)^3 - 1)/6, assuming there are no odd perfect numbers. - Jules Beauchamp, Jun 06 2025

Extensions

I removed a large number of comments that assumed there are no odd perfect numbers. There were so many it was getting hard to tell which comments were true and which were conjectures. - N. J. A. Sloane, Apr 16 2023
Reference to Albert H. Beiler's book updated by Harvey P. Dale, Jan 13 2025

A031443 Digitally balanced numbers: positive numbers that in base 2 have the same number of 0's as 1's.

Original entry on oeis.org

2, 9, 10, 12, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56, 135, 139, 141, 142, 147, 149, 150, 153, 154, 156, 163, 165, 166, 169, 170, 172, 177, 178, 180, 184, 195, 197, 198, 201, 202, 204, 209, 210, 212, 216, 225, 226, 228, 232, 240, 527, 535, 539, 541, 542, 551
Offset: 1

Views

Author

Keywords

Comments

Also numbers k such that the binary digital mean dm(2, k) = (Sum_{i=1..d} 2*d_i - 1) / (2*d) = 0, where d is the number of digits in the binary representation of k and d_i the individual digits. - Reikku Kulon, Sep 21 2008
From Reikku Kulon, Sep 29 2008: (Start)
Each run of values begins with 2^(2k + 1) + 2^(k + 1) - 2^k - 1. The initial values increase according to the sequence {2^(k - 1), 2^(k - 2), 2^(k - 3), ..., 2^(k - k)}.
After this, the values follow a periodic sequence of increases by successive powers of two with single odd values interspersed.
Each run ends with an odd increase followed by increases of {2^(k - k), ..., 2^(k - 2), 2^(k - 1), 2^k}, finally reaching 2^(2k + 2) - 2^(k + 1).
Similar behavior occurs in other bases. (End)
Numbers k such that A000120(k)/A070939(k) = 1/2. - Ctibor O. Zizka, Oct 15 2008
Subsequence of A053754; A179888 is a subsequence. - Reinhard Zumkeller, Jul 31 2010
A000120(a(n)) = A023416(a(n)); A037861(a(n)) = 0.
A001700 gives number of terms having length 2*n in binary representation: A001700(n-1) = #{m: A070939(a(m))=2*n}. - Reinhard Zumkeller, Jun 08 2011
The number of terms below 2^k is A079309(floor(k/2)) for k > 1. - Amiram Eldar, Nov 21 2020

Examples

			9 is a term because '1001' contains 2 '0's and 2 '1's.
		

Crossrefs

Subsequence of A053754.
Row n = 2 of A378000.
Terms of binary width n are enumerated by A001700.

Programs

  • Haskell
    -- See link, showing that Ulrich Schimkes formula provides a very efficient algorithm. Reinhard Zumkeller, Jun 15 2011
    
  • Magma
    [ n: n in [2..250] | Multiplicity({* z: z in Intseq(n,2) *}, 0) eq &+Intseq(n,2) ];  // Bruno Berselli, Jun 07 2011
    
  • Maple
    a:=proc(n) local nn, n1, n0: nn:=convert(n,base,2): n1:=add(nn[i],i=1..nops(nn)): n0:=nops(nn)-n1: if n0=n1 then n else end if end proc: seq(a(n), n = 1..240); # Emeric Deutsch, Jul 31 2008
  • Mathematica
    Select[Range[250],DigitCount[#,2,1]==DigitCount[#,2,0]&] (* Harvey P. Dale, Jul 22 2013 *)
    FromDigits[#,2]&/@DeleteCases[Flatten[Permutations/@Table[PadRight[{},2n,{1,0}],{n,5}],1],?(#[[1]]==0&)]//Sort (* _Harvey P. Dale, May 30 2016 *)
  • PARI
    for(n=1,100,b=binary(n); l=length(b); if(sum(i=1,l, component(b,i))==l/2,print1(n,",")))
    
  • PARI
    is(n)=hammingweight(n)==hammingweight(bitneg(n,#binary(n))) \\ Charles R Greathouse IV, Mar 29 2013
    
  • PARI
    is(n)=2*hammingweight(n)==exponent(n)+1 \\ Charles R Greathouse IV, Apr 18 2020
    
  • Perl
    for my $half ( 1 .. 4 ) {
      my $N = 2 * $half;  # only even widths apply
      my $vector = (1 << ($N-1)) | ((1 << ($N/2-1)) - 1);  # first key
      my $n = 1; $n *= $_ for 2 .. $N;    # N!
      my $d = 1; $d *= $_ for 2 .. $N/2;  # (N/2)!
      for (1 .. $n/($d*$d*2)) {
        print "$vector, ";
        my ($v, $d) = ($vector, 0);
        until ($v & 1 or !$v) { $d = ($d << 1)|1; $v >>= 1 }
        $vector += $d + 1 + (($v ^ ($v + 1)) >> 2);  # next key
      }
    } # Ruud H.G. van Tol, Mar 30 2014
    
  • Python
    from sympy.utilities.iterables import multiset_permutations
    A031443_list = [int('1'+''.join(p),2) for n in range(1,10) for p in multiset_permutations('0'*n+'1'*(n-1))] # Chai Wah Wu, Nov 15 2019

Formula

a(n+1) = a(n) + 2^k + 2^(m-1) - 1 + floor((2^(k+m) - 2^k)/a(n))*(2^(2*m) + 2^(m-1)) where k is the largest integer such that 2^k divides a(n) and m is the largest integer such that 2^m divides a(n)/2^k+1. - Ulrich Schimke (UlrSchimke(AT)aol.com)
A145037(a(n)) = 0. - Reikku Kulon, Oct 02 2008

A145037 Number of 1's minus number of 0's in the binary representation of n.

Original entry on oeis.org

0, 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, -1, -1, 1, -1, 1, 1, 3, -3, -1, -1, 1, -1, 1, 1, 3, -1, 1, 1
Offset: 0

Views

Author

Reikku Kulon, Sep 30 2008

Keywords

Comments

Column 2 of A144912 (which begins at n = 2).
Zeros in that column correspond to A031443.

Examples

			From _Michel Marcus_, Feb 12 2022: (Start)
Viewed as an irregular triangle:
   0;
   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;
  ... (End)
		

Crossrefs

Cf. A037861 (negated), A031443 (indices of 0's), A144912, A000120.
Cf. A269735 (first differences), A268289 (partial sums).
Column k=1 of A360099.

Programs

  • Haskell
    a145037 0 = 0
    a145037 n = a145037 n' + 2*m - 1 where (n', m) = divMod n 2
    -- Reinhard Zumkeller, Jun 16 2011
    
  • Maple
    a:= n-> add(2*i-1, i=Bits[Split](n)):
    seq(a(n), n=0..90);  # Alois P. Heinz, Jan 18 2022
  • Mathematica
    Join[{0}, Table[Count[#, 1] - Count[#, 0] &[IntegerDigits[n, 2]], {n, 1, 90}]] (* Robert P. P. McKone, Feb 12 2022 *)
  • PARI
    A145037(n)=hammingweight(n)*2-logint(n<<1+!n,2) \\ M. F. Hasler, Mar 08 2018
    
  • Python
    result = [0]
    for n in range (1, 2**14 + 1):
        result.append(bin(n)[2:].count("1") - bin(n)[2:].count("0"))
    print(result[0:129]) # Karl-Heinz Hofmann, Jan 18 2022
    
  • Python
    def a(n): return (n.bit_count()<<1) - n.bit_length()
    print([a(n) for n in range(1, 2**14+1)]) # Michael S. Branicky, May 14 2024
    (C#)
    int A145037(int n)  {
        int result = 0;
        while(n > 0)  {
            result += 2 * (n % 2) - 1;
            n /= 2;
        }
        return result;
    } \\ Frank Hollstein, Dec 08 2022

Formula

a(n) = -A037861(n) for n >= 1.
a(n) = Sum_{i=1..k} (2*b[i] - 1) where b is the binary expansion of n and k is the number of bits in this binary expansion. - Michel Marcus, Jun 28 2021
From Aayush Soni Feb 12 2022: (Start)
Upper bound: a(n) <= floor(log_2(n+1)).
Lower bound: For n > 0, a(n) >= 1 - floor(log_2(n)).
If n is even, a(2^n) to a(2^(n+1)-1) inclusive are all odd and vice versa. (End)

Extensions

Renamed (using a Mar 08 2018 comment from M. F. Hasler) and edited by Jon E. Schoenfield, Jun 29 2021

A144917 a(n) is the maximal odd value attained by A144916(n).

Original entry on oeis.org

1, 3, 7, 13, 19, 25, 31, 37, 43, 49, 55, 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, 121, 127, 133, 139, 145, 151, 157, 163, 169, 175, 181, 187, 193, 199, 205, 211, 217, 223, 229, 235, 241, 247, 253, 259, 265, 271, 277, 283, 289, 295, 301, 307, 313, 319, 325, 331
Offset: 1

Views

Author

Reikku Kulon, Sep 25 2008

Keywords

Comments

Most of these are primes or semiprimes.
Is a(n) = A271114(n-2) for n>=3 ? - R. J. Mathar, Jun 21 2025

Crossrefs

A147696 Triangle read by rows: numbers n and columns k such that T(n, k) is n mod k.

Original entry on oeis.org

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

Views

Author

Reikku Kulon, Nov 10 2008

Keywords

Comments

The triangle begins with (2, 2).
Each row can be produced from the previous row by adding one to each number and resetting to zero any which would equal their column number. A number p > 2 is prime iff row p contains no zeros.
A new column k begins at row n when n is a perfect square. T(n, k) is then 1, while T(n, sqrt(n) = k - 1) is 0.
Zeros correspond to ones in the Redheffer matrix. Various interesting patterns exist. For example, as noted above, T(n^2, n) = 0. Also:
T(n^2 + n, n) = T(n^2 + n, n + 1) = 0
T(n^2 + n - 2, n - 1) = 0
T(n^2 - 1, n - 1) = 0
For all k in some [0, c]:
T(n^2, 2 + k) = 0 if n is even
T(n^2, 2 + k) = 1 if n is odd
T(n^2 + n, 2 + k) = 0
Every zero is located on some parabola directed toward n = 0, having either even width and produced by an even sequence; or having an odd width and produced by an odd sequence. In either case, the relevant sequence has constant first differences 2. T(n^2, n) begins an odd parabola, while T(n^2 + n, n) begins an even parabola and parabolas of either variety extend from infinitely many other locations.

Examples

			The triangle begins:
0
1
0 1
1 2
0 0
1 1
0 2
1 0 1
0 1 2
1 2 3
0 0 0
1 1 1
0 2 2
1 0 3
0 1 0 1
1 2 1 2
0 0 2 3
1 1 3 4
0 2 0 0
1 0 1 1
0 1 2 2
1 2 3 3
0 0 0 4
		

Crossrefs

Showing 1-10 of 10 results.