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 19 results. Next

A283484 Odd bisection of A283983; square root of the largest square dividing A277324.

Original entry on oeis.org

1, 1, 3, 1, 3, 3, 15, 1, 3, 15, 45, 15, 15, 15, 105, 1, 3, 105, 225, 525, 1575, 1125, 1575, 105, 105, 525, 1575, 525, 105, 105, 1155, 1, 3, 1155, 1575, 3675, 7875, 275625, 55125, 5775, 17325, 275625, 4134375, 55125, 55125, 275625, 121275, 1155, 1155, 40425, 385875, 202125, 606375, 1929375, 606375, 5775, 8085, 40425, 121275, 40425, 1155, 1155, 15015, 1, 3
Offset: 0

Views

Author

Antti Karttunen, Mar 25 2017

Keywords

Crossrefs

Programs

Formula

a(n) = A283983((2*n)+1).
a(n) = A000188(A277324(n)).
A001222(a(n)) = A284265(n).

A284267 Number of terms with coefficient 1 in the Stern polynomial B(2n+1,x): a(n) = A056169(A277324(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Mar 25 2017

Keywords

Comments

Number of 1's on row 2n+1 of table A125184.

Crossrefs

Odd bisection of A284271.

Programs

Formula

a(n) = A284271((2*n)+1).
a(n) = A056169(A277324(n)).
Other identities. For all n >= 0:
A007306(1+n) = a(n) + A284268(n).

A284268 Sum of coefficients > 1 in the Stern polynomial B(2n+1,x): a(n) = A275812(A277324(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Mar 25 2017

Keywords

Comments

Sum of terms larger than one on row 2n+1 of table A125184.

Crossrefs

Odd bisection of A284272.

Programs

Formula

a(n) = A284272((2*n)+1).
a(n) = A275812(A277324(n)).
Other identities. For all n >= 0:
A007306(1+n) = A284267(n) + a(n).

A284563 a(n) = A247503(A277324(n)).

Original entry on oeis.org

2, 2, 2, 10, 10, 10, 50, 10, 10, 250, 250, 50, 250, 250, 50, 110, 110, 250, 6250, 1250, 1250, 31250, 6250, 550, 2750, 6250, 6250, 13750, 2750, 2750, 6050, 110, 110, 30250, 68750, 13750, 343750, 781250, 156250, 151250, 151250, 781250, 19531250, 1718750, 343750, 8593750, 756250, 6050, 30250, 756250, 1718750, 3781250, 3781250, 8593750, 18906250, 151250
Offset: 0

Views

Author

Antti Karttunen, Mar 29 2017

Keywords

Crossrefs

Odd bisection of A284553.

Programs

  • Mathematica
    a[n_] := a[n] = Which[n < 2, n + 1, EvenQ@ n, Times @@ Map[#1^#2 & @@ # &, FactorInteger[#] /. {p_, e_} /; e > 0 :> {Prime[PrimePi@ p + 1], e}] - Boole[# == 1] &@ a[n/2], True, a[#] a[# + 1] &[(n - 1)/2]]; Table[Times @@ (FactorInteger[#] /. {p_, e_} /; e > 0 :> (p^Mod[PrimePi@ p, 2])^e) &@ a[2 n + 1], {n, 0, 55}] (* Michael De Vlieger, Apr 05 2017 *)
  • PARI
    A284563(n) = A284553(n+n+1); \\ Other code as in A284553.
    
  • Scheme
    (define (A284563 n) (A247503 (A277324 n)))
    (define (A284563 n) (A284553 (+ n n 1)))

Formula

a(n) = A247503(A277324(n)).
a(n) = A284553((2*n)+1).
Other identities. For all n >= 0:
A001222(a(n)) = A284565(n).

A284564 a(n) = A248101(A277324(n)).

Original entry on oeis.org

1, 3, 9, 3, 9, 27, 9, 21, 63, 27, 81, 189, 63, 189, 441, 21, 63, 1323, 567, 1323, 3969, 1701, 3969, 1323, 441, 9261, 27783, 1323, 3087, 9261, 441, 273, 819, 1323, 27783, 64827, 27783, 583443, 1361367, 9261, 27783, 4084101, 1750329, 583443, 1361367, 583443, 194481, 17199, 5733, 453789, 9529569, 453789, 1361367, 28588707, 1361367, 120393, 280917, 453789, 1361367
Offset: 0

Views

Author

Antti Karttunen, Mar 29 2017

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = Which[n < 2, n + 1, EvenQ@ n, Times @@ Map[#1^#2 & @@ # &, FactorInteger[#] /. {p_, e_} /; e > 0 :> {Prime[PrimePi@ p + 1], e}] - Boole[# == 1] &@ a[n/2], True, a[#] a[# + 1] &[(n - 1)/2]]; Table[Times @@ (FactorInteger[#] /. {p_, e_} /; e > 0 :> (p^Mod[PrimePi@ p + 1, 2])^e) &@ a[2 n + 1], {n, 0, 58}] (* Michael De Vlieger, Apr 05 2017 *)
  • PARI
    A284564(n) = A284554(n+n+1); \\ Other code as in A284554.
    
  • Scheme
    (define (A284564 n) (A248101 (A277324 n)))
    (define (A284564 n) (A284554 (+ n n 1)))

Formula

a(n) = A248101(A277324(n)).
a(n) = A284554((2*n)+1).
Other identities. For all n >= 0:
A001222(a(n)) = A284566(n).

A284573 Odd bisection of A278243: a(n) = A046523(A277324(n)).

Original entry on oeis.org

2, 6, 12, 30, 60, 120, 180, 210, 420, 1080, 2160, 2520, 2520, 7560, 6300, 2310, 4620, 37800, 90720, 75600, 226800, 544320, 453600, 138600, 138600, 756000, 2268000, 831600, 415800, 2079000, 485100, 30030, 60060, 2910600, 24948000, 12474000, 49896000, 272160000, 136080000, 29106000, 87318000, 1360800000, 3265920000, 1496880000, 748440000
Offset: 0

Views

Author

Antti Karttunen, Apr 11 2017

Keywords

Crossrefs

Programs

Formula

a(n) = A046523(A277324(n)).
a(n) = A278243((2*n)+1).

A156552 Unary-encoded compressed factorization of natural numbers.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 8, 7, 6, 9, 16, 11, 32, 17, 10, 15, 64, 13, 128, 19, 18, 33, 256, 23, 12, 65, 14, 35, 512, 21, 1024, 31, 34, 129, 20, 27, 2048, 257, 66, 39, 4096, 37, 8192, 67, 22, 513, 16384, 47, 24, 25, 130, 131, 32768, 29, 36, 71, 258, 1025, 65536, 43, 131072, 2049, 38, 63, 68, 69, 262144
Offset: 1

Views

Author

Leonid Broukhis, Feb 09 2009

Keywords

Comments

The primes become the powers of 2 (2 -> 1, 3 -> 2, 5 -> 4, 7 -> 8); the composite numbers are formed by taking the values for the factors in the increasing order, multiplying them by the consecutive powers of 2, and summing. See the Example section.
From Antti Karttunen, Jun 27 2014: (Start)
The odd bisection (containing even terms) halved gives A244153.
The even bisection (containing odd terms), when one is subtracted from each and halved, gives this sequence back.
(End)
Question: Are there any other solutions that would satisfy the recurrence r(1) = 0; and for n > 1, r(n) = Sum_{d|n, d>1} 2^A033265(r(d)), apart from simple variants 2^k * A156552(n)? See also A297112, A297113. - Antti Karttunen, Dec 30 2017

Examples

			For 84 = 2*2*3*7 -> 1*1 + 1*2 + 2*4 + 8*8 =  75.
For 105 = 3*5*7 -> 2*1 + 4*2 + 8*4 = 42.
For 137 = p_33 -> 2^32 = 4294967296.
For 420 = 2*2*3*5*7 -> 1*1 + 1*2 + 2*4 + 4*8 + 8*16 = 171.
For 147 = 3*7*7 = p_2 * p_4 * p_4 -> 2*1 + 8*2 + 8*4 = 50.
		

Crossrefs

One less than A005941.
Inverse permutation: A005940 with starting offset 0 instead of 1.
Cf. also A297106, A297112 (Möbius transform), A297113, A153013, A290308, A300827, A323243, A323244, A323247, A324201, A324812 (n for which a(n) is a square), A324813, A324822, A324823, A324398, A324713, A324815, A324819, A324865, A324866, A324867.

Programs

  • Mathematica
    Table[Floor@ Total@ Flatten@ MapIndexed[#1 2^(#2 - 1) &, Flatten[ Table[2^(PrimePi@ #1 - 1), {#2}] & @@@ FactorInteger@ n]], {n, 67}] (* Michael De Vlieger, Sep 08 2016 *)
  • PARI
    a(n) = {my(f = factor(n), p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res}; \\ David A. Corneth, Mar 08 2019
    
  • PARI
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A156552(n) = if(1==n, 0, if(!(n%2), 1+(2*A156552(n/2)), 2*A156552(A064989(n)))); \\ (based on the given recurrence) - Antti Karttunen, Mar 08 2019
    
  • Perl
    # Program corrected per instructions from Leonid Broukhis. - Antti Karttunen, Jun 26 2014
    # However, it gives correct answers only up to n=136, before corruption by a wrap-around effect.
    # Note that the correct answer for n=137 is A156552(137) = 4294967296.
    $max = $ARGV[0];
    $pow = 0;
    foreach $i (2..$max) {
    @a = split(/ /, `factor $i`);
    shift @a;
    $shift = 0;
    $cur = 0;
    while ($n = int shift @a) {
    $prime{$n} = 1 << $pow++ if !defined($prime{$n});
    $cur |= $prime{$n} << $shift++;
    }
    print "$cur, ";
    }
    print "\n";
    (Scheme, with memoization-macro definec from Antti Karttunen's IntSeq-library, two different implementations)
    (definec (A156552 n) (cond ((= n 1) 0) (else (+ (A000079 (+ -2 (A001222 n) (A061395 n))) (A156552 (A052126 n))))))
    (definec (A156552 n) (cond ((= 1 n) (- n 1)) ((even? n) (+ 1 (* 2 (A156552 (/ n 2))))) (else (* 2 (A156552 (A064989 n))))))
    ;; Antti Karttunen, Jun 26 2014
    
  • Python
    from sympy import primepi, factorint
    def A156552(n): return sum((1<Chai Wah Wu, Mar 10 2023

Formula

From Antti Karttunen, Jun 26 2014: (Start)
a(1) = 0, a(n) = A000079(A001222(n)+A061395(n)-2) + a(A052126(n)).
a(1) = 0, a(2n) = 1+2*a(n), a(2n+1) = 2*a(A064989(2n+1)). [Compare to the entanglement recurrence A243071].
For n >= 0, a(2n+1) = 2*A244153(n+1). [Follows from the latter clause of the above formula.]
a(n) = A005941(n) - 1.
As a composition of related permutations:
a(n) = A003188(A243354(n)).
a(n) = A054429(A243071(n)).
For all n >= 1, A005940(1+a(n)) = n and for all n >= 0, a(A005940(n+1)) = n. [The offset-0 version of A005940 works as an inverse for this permutation.]
This permutations also maps between the partition-lists A112798 and A125106:
A056239(n) = A161511(a(n)). [The sums of parts of each partition (the total sizes).]
A003963(n) = A243499(a(n)). [And also the products of those parts.]
(End)
From Antti Karttunen, Oct 09 2016: (Start)
A161511(a(n)) = A056239(n).
A029837(1+a(n)) = A252464(n). [Binary width of terms.]
A080791(a(n)) = A252735(n). [Number of nonleading 0-bits.]
A000120(a(n)) = A001222(n). [Binary weight.]
For all n >= 2, A001511(a(n)) = A055396(n).
For all n >= 2, A000120(a(n))-1 = A252736(n). [Binary weight minus one.]
A252750(a(n)) = A252748(n).
a(A250246(n)) = A252754(n).
a(A005117(n)) = A277010(n). [Maps squarefree numbers to a permutation of A003714, fibbinary numbers.]
A085357(a(n)) = A008966(n). [Ditto for their characteristic functions.]
For all n >= 0:
a(A276076(n)) = A277012(n).
a(A276086(n)) = A277022(n).
a(A260443(n)) = A277020(n).
(End)
From Antti Karttunen, Dec 30 2017: (Start)
For n > 1, a(n) = Sum_{d|n, d>1} 2^A033265(a(d)). [See comments.]
More linking formulas:
A106737(a(n)) = A000005(n).
A290077(a(n)) = A000010(n).
A069010(a(n)) = A001221(n).
A136277(a(n)) = A181591(n).
A132971(a(n)) = A008683(n).
A106400(a(n)) = A008836(n).
A268411(a(n)) = A092248(n).
A037011(a(n)) = A010052(n) [conjectured, depends on the exact definition of A037011].
A278161(a(n)) = A046951(n).
A001316(a(n)) = A061142(n).
A277561(a(n)) = A034444(n).
A286575(a(n)) = A037445(n).
A246029(a(n)) = A181819(n).
A278159(a(n)) = A124859(n).
A246660(a(n)) = A112624(n).
A246596(a(n)) = A069739(n).
A295896(a(n)) = A053866(n).
A295875(a(n)) = A295297(n).
A284569(a(n)) = A072411(n).
A286574(a(n)) = A064547(n).
A048735(a(n)) = A292380(n).
A292272(a(n)) = A292382(n).
A244154(a(n)) = A048673(n), a(A064216(n)) = A244153(n).
A279344(a(n)) = A279339(n), a(A279338(n)) = A279343(n).
a(A277324(n)) = A277189(n).
A037800(a(n)) = A297155(n).
For n > 1, A033265(a(n)) = 1+A297113(n).
(End)
From Antti Karttunen, Mar 08 2019: (Start)
a(n) = A048675(n) + A323905(n).
a(A324201(n)) = A000396(n), provided there are no odd perfect numbers.
The following sequences are derived from or related to the base-2 expansion of a(n):
A000265(a(n)) = A322993(n).
A002487(a(n)) = A323902(n).
A005187(a(n)) = A323247(n).
A324288(a(n)) = A324116(n).
A323505(a(n)) = A323508(n).
A079559(a(n)) = A323512(n).
A085405(a(n)) = A323239(n).
The following sequences are obtained by applying to a(n) a function that depends on the prime factorization of its argument, which goes "against the grain" because a(n) is the binary code of the factorization of n, which in these cases is then factored again:
A000203(a(n)) = A323243(n).
A033879(a(n)) = A323244(n) = 2*a(n) - A323243(n),
A294898(a(n)) = A323248(n).
A000005(a(n)) = A324105(n).
A000010(a(n)) = A324104(n).
A083254(a(n)) = A324103(n).
A001227(a(n)) = A324117(n).
A000593(a(n)) = A324118(n).
A001221(a(n)) = A324119(n).
A009194(a(n)) = A324396(n).
A318458(a(n)) = A324398(n).
A192895(a(n)) = A324100(n).
A106315(a(n)) = A324051(n).
A010052(a(n)) = A324822(n).
A053866(a(n)) = A324823(n).
A001065(a(n)) = A324865(n) = A323243(n) - a(n),
A318456(a(n)) = A324866(n) = A324865(n) OR a(n),
A318457(a(n)) = A324867(n) = A324865(n) XOR a(n),
A318458(a(n)) = A324398(n) = A324865(n) AND a(n),
A318466(a(n)) = A324819(n) = A323243(n) OR 2*a(n),
A318467(a(n)) = A324713(n) = A323243(n) XOR 2*a(n),
A318468(a(n)) = A324815(n) = A323243(n) AND 2*a(n).
(End)

Extensions

More terms from Antti Karttunen, Jun 28 2014

A007306 Denominators of Farey tree fractions (i.e., the Stern-Brocot subtree in the range [0,1]).

Original entry on oeis.org

1, 1, 2, 3, 3, 4, 5, 5, 4, 5, 7, 8, 7, 7, 8, 7, 5, 6, 9, 11, 10, 11, 13, 12, 9, 9, 12, 13, 11, 10, 11, 9, 6, 7, 11, 14, 13, 15, 18, 17, 13, 14, 19, 21, 18, 17, 19, 16, 11, 11, 16, 19, 17, 18, 21, 19, 14, 13, 17, 18, 15, 13, 14, 11, 7, 8, 13, 17, 16, 19, 23, 22, 17, 19, 26, 29, 25, 24
Offset: 0

Views

Author

Keywords

Comments

Also number of odd entries in n-th row of triangle of Stirling numbers of the second kind (A008277). - Benoit Cloitre, Feb 28 2004
Apparently (except for the first term) the number of odd entries in the alternated diagonals of Pascal's triangle at 45 degrees slope. - Javier Torres (adaycalledzero(AT)hotmail.com), Jul 26 2009
The Kn3 and Kn4 triangle sums, see A180662 for their definitions, of Sierpiński's triangle A047999 equal a(n+1). - Johannes W. Meijer, Jun 05 2011
From Yosu Yurramendi, Jun 23 2014: (Start)
If the terms (n>1) are written as an array:
2,
3, 3,
4, 5, 5, 4,
5, 7, 8, 7, 7, 8, 7, 5,
6, 9, 11, 10, 11, 13, 12, 9, 9, 12, 13, 11, 10, 11, 9, 6,
7, 11, 14, 13, 15, 18, 17, 13, 14, 19, 21, 18, 17, 19, 16, 11, 11, 16, 19,17,18,
then the sum of the k-th row is 2*3^(k-2), each column is an arithmetic progression. The differences of the arithmetic progressions give the sequence itself (a(2^(m+1)+1+k) - a(2^m+1+k) = a(k+1), m >= 1, 1 <= k <= 2^m), because a(n) = A002487(2*n-1) and A002487 has these properties. A071585 also has these properties. Each row is a palindrome: a(2^(m+1)+1-k) = a(2^m+k), m >= 0, 1 <= k <= 2^m.
If the terms (n>0) are written in this way:
1,
2, 3,
3, 4, 5, 5,
4, 5, 7, 8, 7, 7, 8, 7,
5, 6, 9, 11, 10, 11, 13, 12, 9, 9, 12, 13, 11, 10, 11, 9,
6, 7, 11, 14, 13, 15, 18, 17, 13, 14, 19, 21, 18, 17, 19, 16, 11, 11, 16, 19,
each column is an arithmetic progression and the steps also give the sequence itself (a(2^(m+1)+k) - a(2^m+k) = a(k), m >= 0, 0 <= k < 2^m). Moreover, by removing the first term of each column:
a(2^(m+1)+k) = A049448(2^m+k+1), m >= 0, 0 <= k < 2^m.
(End)
k > 1 occurs in this sequence phi(k) = A000010(k) times. - Franklin T. Adams-Watters, May 25 2015
Except for the initial 1, this is the odd bisection of A002487. The even bisection of A002487 is A002487 itself. - Franklin T. Adams-Watters, May 25 2015
For all m >= 0, max_{k=1..2^m} a(2^m+k) = A000045(m+3) (Fibonacci sequence). - Yosu Yurramendi, Jun 05 2016
For all n >= 2, max(m: a(2^m+k) = n, 1<=k<=2^m) = n-2. - Yosu Yurramendi, Jun 05 2016
a(2^m+1) = m+2, m >= 0; a(2^m+2) = 2m+1, m>=1; min_{m>=0, k=1..2^m} a(2^m+k) = m+2; min_{m>=2, k=2..2^m-1} a(2^m+k) = 2m+1. - Yosu Yurramendi, Jun 06 2016
a(2^(m+2) + 2^(m+1) - k) - a(2^(m+1) + 2^m-k) = 2*a(k+1), m >= 0, 0 <= k <= 2^m. - Yosu Yurramendi, Jun 09 2016
If the initial 1 is omitted, this is the number of nonzero entries in row n of the generalized Pascal triangle P_2, see A282714 [Leroy et al., 2017]. - N. J. A. Sloane, Mar 02 2017
Apparently, this sequence was introduced by Johann Gustav Hermes in 1894. His paper gives a strong connection between this sequence and the so-called "Gaussian brackets" ("Gauss'schen Klammer"). For an independent discussion about Gaussian brackets, see the relevant MathWorld article and the article by Herzberger (1943). Srinivasan (1958) gave another, more modern, explanation of the connection between this sequence and the Gaussian brackets. (Parenthetically, J. G. Hermes is the mathematician who completed or constructed the regular polygon with 65537 sides.) - Petros Hadjicostas, Sep 18 2019

Examples

			[ 0/1; 1/1; ] 1/2; 1/3, 2/3; 1/4, 2/5, 3/5, 3/4; 1/5, 2/7, 3/8, 3/7, 4/7, 5/8, 5/7, 4/5; ...
		

References

  • P. Bachmann, Niedere Zahlentheorie (1902, 1910), reprinted Chelsea, NY, 1968, vol. 2, p. 61.
  • L. E. Dickson, History of the Theory of Numbers. Carnegie Institute Public. 256, Washington, DC, Vol. 1, 1919; Vol. 2, 1920; Vol. 3, 1923, see vol. 1, p. 158.
  • J. C. Lagarias, Number Theory and Dynamical Systems, pp. 35-72 of S. A. Burr, ed., The Unreasonable Effectiveness of Number Theory, Proc. Sympos. Appl. Math., 46 (1992). Amer. Math. Soc.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Magma
    [1] cat [&+[Binomial(n+k,2*k) mod 2: k in [0..n]]: n in [0..80]]; // Vincenzo Librandi, Jun 10 2019
  • Maple
    A007306 := proc(n): if n=0 then 1 else A002487(2*n-1) fi: end: A002487 := proc(m) option remember: local a, b, n; a := 1; b := 0; n := m; while n>0 do if type(n, odd) then b := a + b else a := a + b end if; n := floor(n/2); end do; b; end proc: seq(A007306(n),n=0..77); # Johannes W. Meijer, Jun 05 2011
  • Mathematica
    a[0] = 1; a[n_] := Sum[ Mod[ Binomial[n+k-1, 2k] , 2], {k, 0, n}]; Table[a[n], {n, 0, 77}] (* Jean-François Alcover, Dec 16 2011, after Paul Barry *)
    a[0] = 0; a[1] = 1;
    Flatten[{1,Table[a[2*n] = a[n]; a[2*n + 1] = a[n] + a[n + 1], {n, 0, 50}]}] (* Horst H. Manninger, Jun 09 2021 *)
  • PARI
    {a(n) = if( n<1, n==0, n--; sum( k=0, n, binomial( n+k, n-k)%2))};
    
  • PARI
    {a(n) = my(m); if( n<2, n>=0, m = 2^length( binary( n-1)); a(n - m/2) + a(m-n+1))}; /* Michael Somos, May 30 2005 */
    
  • Python
    from sympy import binomial
    def a(n):
        return 1 if n<1 else sum(binomial(n + k - 1, 2*k) % 2 for k in range(n + 1))
    print([a(n) for n in range(101)]) # Indranil Ghosh, Mar 22 2017
    
  • Python
    from functools import reduce
    def A007306(n): return sum(reduce(lambda x,y:(x[0],sum(x)) if int(y) else (sum(x),x[1]),bin((n<<1)-1)[-1:2:-1],(1,0))) if n else 1 # Chai Wah Wu, May 18 2023
    
  • R
    maxrow <- 6 # by choice
    a <- c(1,2)
    for(m in 0:maxrow) for(k in 1:2^m){
      a[2^(m+1)+k  ] <- a[2^m+k] + a[k]
      a[2^(m+1)-k+1] <- a[2^m+k]
    }
    a
    # Yosu Yurramendi, Jan 05 2015
    
  • R
    # Given n, compute directly a(n)
    # by taking into account the binary representation of n-1
    # aa <- function(n){
      b <- as.numeric(intToBits(n))
      l <- sum(b)
      m <- which(b == 1)-1
      d <- 1
      if(l > 1) for(j in 1:(l-1)) d[j] <- m[j+1]-m[j]+1
      f <- c(1,m[1]+2) # In A002487: f <- c(0,1)
      if(l > 1) for(j in 3:(l+1)) f[j] <- d[j-2]*f[j-1]-f[j-2]
      return(f[l+1])
    }
    # a(0) = 1, a(1) = 1, a(n) = aa(n-1)   n > 1
    #
    # Example
    n <- 73
    aa(n-1)
    #
    # Yosu Yurramendi, Dec 15 2016
    
  • Sage
    @CachedFunction
    def a(n):
        return a((odd_part(n-1)+1)/2)+a((odd_part(n)+1)/2) if n>1 else 1
    [a(n) for n in (0..77)] # after Alessandro De Luca, Peter Luschny, May 20 2014
    
  • Sage
    def A007306(n):
        if n == 0: return 1
        M = [1, 1]
        for b in (n-1).bits():
            M[b] = M[0] + M[1]
        return M[1]
    print([A007306(n) for n in (0..77)]) # Peter Luschny, Nov 28 2017
    
  • Scheme
    (define (A007306 n) (if (zero? n) 1 (A002487 (+ n n -1)))) ;; Code for A002487 given in that entry. - Antti Karttunen, Mar 21 2017
    

Formula

Recurrence: a(0) to a(8) are 1, 1, 2, 3, 3, 4, 5, 5, 4; thereafter a(n) = a(n-2^p) + a(2^(p+1)-n+1), where 2^p < n <= 2^(p+1). [J. Hermes, Math. Ann., 1894; quoted by Dickson, Vol. 1, p. 158] - N. J. A. Sloane, Mar 24 2019
a(4*n) = -a(n)+2*a(2*n); a(4*n+1) = -a(n)+a(2*n)+a(2*n+1); a(4*n+2)=a(n)-a(2*n)+2*a(2*n+1); a(4*n+3) = 4*a(n)-4*a(2*n)+3*a(2*n+1). Thus a(n) is a 2-regular sequence. - Jeffrey Shallit, Dec 26 2024
For n > 0, a(n) = A002487(n-1) + A002487(n) = A002487(2*n-1).
a(0) = 1; a(n) = Sum_{k=0..n-1} C(n-1+k, n-1-k) mod 2, n > 0. - Benoit Cloitre, Jun 20 2003
a(n+1) = Sum_{k=0..n} binomial(2*n-k, k) mod 2; a(n) = 0^n + Sum_{k=0..n-1} binomial(2(n-1)-k, k) mod 2. - Paul Barry, Dec 11 2004
a(n) = Sum_{k=0..n} C(n+k,2*k) mod 2. - Paul Barry, Jun 12 2006
a(0) = a(1) = 1; a(n) = a(A003602(n-1)) + a(A003602(n)), n > 1. - Alessandro De Luca, May 08 2014
a(n) = A007305(n+(2^m-1)), m=A029837(n), n=1,2,3,... . - Yosu Yurramendi, Jul 04 2014
a(n) = A007305(2^(m+1)-n) - A007305(2^m-n), m >= (A029837(n)+1), n=1,2,3,... - Yosu Yurramendi, Jul 05 2014
a(2^m) = m+1, a(2^m+1) = m+2 for m >= 0. - Yosu Yurramendi, Jan 01 2015
a(n+2) = A007305(n+2) + A047679(n) n >= 0. - Yosu Yurramendi, Mar 30 2016
a(2^m+2^r+k) = a(2^r+k)(m-r+1) - a(k), m >= 2, 0 <= r <= m-1, 0 <= k < 2^r. Example: a(73) = a(2^6+2^3+1) = a(2^3+1)*(6-3+1) - a(1) = 5*4 - 1 = 19 . - Yosu Yurramendi, Jul 19 2016
From Antti Karttunen, Mar 21 2017 & Apr 12 2017: (Start)
For n > 0, a(n) = A001222(A277324(n-1)) = A001222(A260443(n-1)*A260443(n)).
The following decompositions hold for all n > 0:
a(n) = A277328(n-1) + A284009(n-1).
a(n) = A283986(n) + A283988(n) = A283987(n) + 2*A283988(n).
a(n) = 2*A284265(n-1) + A284266(n-1).
a(n) = A284267(n-1) + A284268(n-1).
a(n) = A284565(n-1) + A284566(n-1).
a(n) = A285106(n-1) + A285108(n-1) = A285107(n-1) + 2*A285108(n-1). (End)
a(A059893(n)) = a(n+1) for n > 0. - Yosu Yurramendi, May 30 2017
a(n) = A287731(n) + A287732(n) for n > 0. - I. V. Serov, Jun 09 2017
a(n) = A287896(n) + A288002(n) for n > 1.
a(n) = A287896(n-1) + A002487(n-1) - A288002(n-1) for n > 1.
a(n) = a(n-1) + A002487(n-1) - 2*A288002(n-1) for n > 1. - I. V. Serov, Jun 14 2017
From Yosu Yurramendi, May 14 2019: (Start)
For m >= 0, M >= m, 0 <= k < 2^m,
a((2^(m+1) + A119608(2^m+k+1))*2^(M-m) - A000035(2^m+k)) =
a((2^(m+2) - A119608(2^m+k+1))*2^(M-m) - A000035(2^m+k)-1) =
a(2^(M+2) - (2^m+k)) = a(2^(M+1) + (2^m+k) + 1) =
a(2^m+k+1)*(M-m) + a(2^(m+1)+2^m+k+1). (End)
a(k) = sqrt(A007305(2^(m+1)+k)*A047679(2^(m+1)+k-2) - A007305(2^m+k)*A047679(2^m+k-2)), m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Jun 09 2019
G.f.: 1 + x * (1 + x) * Product_{k>=0} (1 + x^(2^k) + x^(2^(k+1))). - Ilya Gutkovskiy, Jul 19 2019
Conjecture: a(n) = a(n-1) + b(n-1) - 2*(a(n-1) mod b(n-1)) for n > 1 with a(0) = a(1) = 1 where b(n) = a(n) - b(n-1) for n > 1 with b(1) = 1. - Mikhail Kurkov, Mar 13 2022

Extensions

Formula fixed and extended by Franklin T. Adams-Watters, Jul 07 2009
Incorrect Maple program removed by Johannes W. Meijer, Jun 05 2011

A260443 Prime factorization representation of Stern polynomials: a(0) = 1, a(1) = 2, a(2n) = A003961(a(n)), a(2n+1) = a(n)*a(n+1).

Original entry on oeis.org

1, 2, 3, 6, 5, 18, 15, 30, 7, 90, 75, 270, 35, 450, 105, 210, 11, 630, 525, 6750, 245, 20250, 2625, 9450, 77, 15750, 3675, 47250, 385, 22050, 1155, 2310, 13, 6930, 5775, 330750, 2695, 3543750, 128625, 1653750, 847, 4961250, 643125, 53156250, 18865, 24806250, 202125, 727650, 143, 1212750, 282975, 57881250, 29645, 173643750, 1414875, 18191250, 1001
Offset: 0

Views

Author

Antti Karttunen, Jul 28 2015

Keywords

Comments

The exponents in the prime factorization of term a(n) give the coefficients of the n-th Stern polynomial. See A125184 and the examples.
None of the terms have prime gaps in their factorization, i.e., all can be found in A073491.
Contains neither perfect squares nor prime powers with exponent > 1. A277701 gives the positions of the terms that are 2*square. - Antti Karttunen, Oct 27 2016
Many of the derived sequences (like A002487) have similar "Fir forest" or "Gaudian cathedrals" style scatter plot. - Antti Karttunen, Mar 21 2017

Examples

			n    a(n)   prime factorization    Stern polynomial
------------------------------------------------------------
0       1   (empty)                B_0(x) = 0
1       2   p_1                    B_1(x) = 1
2       3   p_2                    B_2(x) = x
3       6   p_2 * p_1              B_3(x) = x + 1
4       5   p_3                    B_4(x) = x^2
5      18   p_2^2 * p_1            B_5(x) = 2x + 1
6      15   p_3 * p_2              B_6(x) = x^2 + x
7      30   p_3 * p_2 * p_1        B_7(x) = x^2 + x + 1
8       7   p_4                    B_8(x) = x^3
9      90   p_3 * p_2^2 * p_1      B_9(x) = x^2 + 2x + 1
		

Crossrefs

Same sequence sorted into ascending order: A260442.
Cf. also A048675, A277333 (left inverses).
Cf. A277323, A277324 (bisections), A277200 (even terms sorted), A277197 (first differences), A277198.
Cf. A277316 (values at primes), A277318.
Cf. A023758 (positions of squarefree terms), A101082 (of terms not squarefree), A277702 (positions of records), A277703 (their values).
Cf. A283992, A283993 (number of irreducible, reducible polynomials in range 1 .. n).
Cf. also A206296 (Fibonacci polynomials similarly represented).

Programs

  • Maple
    b:= n-> mul(nextprime(i[1])^i[2], i=ifactors(n)[2]):
    a:= proc(n) option remember; `if`(n<2, n+1,
          `if`(irem(n, 2, 'h')=0, b(a(h)), a(h)*a(n-h)))
        end:
    seq(a(n), n=0..56);  # Alois P. Heinz, Jul 04 2024
  • Mathematica
    a[n_] := a[n] = Which[n < 2, n + 1, EvenQ@ n, Times @@ Map[#1^#2 & @@ # &, FactorInteger[#] /. {p_, e_} /; e > 0 :> {Prime[PrimePi@ p + 1], e}] - Boole[# == 1] &@ a[n/2], True, a[#] a[# + 1] &[(n - 1)/2]]; Table[a@ n, {n, 0, 56}] (* Michael De Vlieger, Apr 05 2017 *)
  • PARI
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From Michel Marcus
    A260443(n) = if(n<2, n+1, if(n%2, A260443(n\2)*A260443(n\2+1), A003961(A260443(n\2)))); \\ After Charles R Greathouse IV's code for "ps" in A186891.
    \\ Antti Karttunen, Oct 11 2016
    
  • Python
    from sympy import factorint, prime, primepi
    from functools import reduce
    from operator import mul
    def a003961(n):
        F = factorint(n)
        return 1 if n==1 else reduce(mul, (prime(primepi(i) + 1)**F[i] for i in F))
    def a(n): return n + 1 if n<2 else a003961(a(n//2)) if n%2==0 else a((n - 1)//2)*a((n + 1)//2)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 21 2017
  • Scheme
    ;; Uses memoization-macro definec:
    (definec (A260443 n) (cond ((<= n 1) (+ 1 n)) ((even? n) (A003961 (A260443 (/ n 2)))) (else (* (A260443 (/ (- n 1) 2)) (A260443 (/ (+ n 1) 2))))))
    ;; A more standalone version added Oct 10 2016, requiring only an implementation of A000040 and the memoization-macro definec:
    (define (A260443 n) (product_primes_to_kth_powers (A260443as_coeff_list n)))
    (define (product_primes_to_kth_powers nums) (let loop ((p 1) (nums nums) (i 1)) (cond ((null? nums) p) (else (loop (* p (expt (A000040 i) (car nums))) (cdr nums) (+ 1 i))))))
    (definec (A260443as_coeff_list n) (cond ((zero? n) (list)) ((= 1 n) (list 1)) ((even? n) (cons 0 (A260443as_coeff_list (/ n 2)))) (else (add_two_lists (A260443as_coeff_list (/ (- n 1) 2)) (A260443as_coeff_list (/ (+ n 1) 2))))))
    (define (add_two_lists nums1 nums2) (let ((len1 (length nums1)) (len2 (length nums2))) (cond ((< len1 len2) (add_two_lists nums2 nums1)) (else (map + nums1 (append nums2 (make-list (- len1 len2) 0)))))))
    

Formula

a(0) = 1, a(1) = 2, a(2n) = A003961(a(n)), a(2n+1) = a(n)*a(n+1).
Other identities. For all n >= 0:
A001221(a(n)) = A277314(n). [#nonzero coefficients in each polynomial.]
A001222(a(n)) = A002487(n). [When each polynomial is evaluated at x=1.]
A048675(a(n)) = n. [at x=2.]
A090880(a(n)) = A178590(n). [at x=3.]
A248663(a(n)) = A264977(n). [at x=2 over the field GF(2).]
A276075(a(n)) = A276081(n). ["at factorials".]
A156552(a(n)) = A277020(n). [Converted to "unary-binary" encoding.]
A051903(a(n)) = A277315(n). [Maximal coefficient.]
A277322(a(n)) = A277013(n). [Number of irreducible polynomial factors.]
A005361(a(n)) = A277325(n). [Product of nonzero coefficients.]
A072411(a(n)) = A277326(n). [And their LCM.]
A007913(a(n)) = A277330(n). [The squarefree part.]
A000005(a(n)) = A277705(n). [Number of divisors.]
A046523(a(n)) = A278243(n). [Filter-sequence.]
A284010(a(n)) = A284011(n). [True for n > 1. Another filter-sequence.]
A003415(a(n)) = A278544(n). [Arithmetic derivative.]
A056239(a(n)) = A278530(n). [Weighted sum of coefficients.]
A097249(a(n)) = A277899(n).
a(A000079(n)) = A000040(n+1).
a(A000225(n)) = A002110(n).
a(A000051(n)) = 3*A002110(n).
For n >= 1, a(A000918(n)) = A070826(n).
A007949(a(n)) is the interleaving of A000035 and A005811, probably A101979.
A061395(a(n)) = A277329(n).
Also, for all n >= 1:
A055396(a(n)) = A001511(n).
A252735(a(n)) = A061395(a(n)) - 1 = A057526(n).
a(A000040(n)) = A277316(n).
a(A186891(1+n)) = A277318(n). [Subsequence for irreducible polynomials].

Extensions

More linking formulas added by Antti Karttunen, Mar 21 2017

A260442 Sequence A260443 sorted into ascending order.

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 11, 13, 15, 17, 18, 19, 23, 29, 30, 31, 35, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 75, 77, 79, 83, 89, 90, 97, 101, 103, 105, 107, 109, 113, 127, 131, 137, 139, 143, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 210, 211, 221, 223, 227, 229, 233, 239, 241, 245, 251, 257, 263, 269, 270, 271, 277, 281, 283, 293, 307, 311
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2015

Keywords

Comments

Each term is a prime factorization encoding of one of the Stern polynomials. See A260443 for details.
Numbers n for which A260443(A048675(n)) = n. - Antti Karttunen, Oct 14 2016

Crossrefs

Subsequence of A073491.
From 2 onward the positions of nonzeros in A277333.
Various subsequences: A000040, A002110, A070826, A277317, A277200 (even terms). Also all terms of A277318 are included here.
Cf. also A277323, A277324 and permutation pair A277415 & A277416.

Programs

  • PARI
    allocatemem(2^30);
    A048675(n) = my(f = factor(n)); sum(k=1, #f~, f[k, 2]*2^primepi(f[k, 1]))/2; \\ Michel Marcus, Oct 10 2016
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From Michel Marcus
    A260443(n) = if(n<2, n+1, if(n%2, A260443(n\2)*A260443(n\2+1), A003961(A260443(n\2))));
    isA260442(n) = (A260443(A048675(n)) == n);  \\ The most naive version.
    A055396(n) = if(n==1, 0, primepi(factor(n)[1, 1])) \\ Charles R Greathouse IV, Apr 23 2015
    A061395(n) =  if(1==n, 0, primepi(vecmax(factor(n)[, 1]))); \\ After M. F. Hasler's code for A006530.
    isA260442(n) = ((1==n) || isprime(n) || ((omega(n) == 1+(A061395(n)-A055396(n))) && (A260443(A048675(n)) == n))); \\ Somewhat optimized.
    i=0; n=0; while(i < 10001, n++; if(isA260442(n), write("b260442.txt", i, " ", n); i++));
    \\ Antti Karttunen, Oct 14 2016
    
  • Python
    from sympy import factorint, prime, primepi
    from operator import mul
    from functools import reduce
    def a048675(n):
        F=factorint(n)
        return 0 if n==1 else sum([F[i]*2**(primepi(i) - 1) for i in F])
    def a003961(n):
        F=factorint(n)
        return 1 if n==1 else reduce(mul, [prime(primepi(i) + 1)**F[i] for i in F])
    def a(n): return n + 1 if n<2 else a003961(a(n//2)) if n%2==0 else a((n - 1)//2)*a((n + 1)//2)
    print([n for n in range(301) if a(a048675(n))==n]) # Indranil Ghosh, Jun 21 2017
  • Scheme
    ;; With Antti Karttunen's IntSeq-library.
    (define A260442 (FIXED-POINTS 0 1 (COMPOSE A260443 A048675)))
    ;; An optimized version:
    (define A260442 (MATCHING-POS 0 1 (lambda (n) (or (= 1 n) (= 1 (A010051 n)) (and (not (< (A001221 n) (+ 1 (A243055 n)))) (= n (A260443 (A048675 n))))))))
    ;; Antti Karttunen, Oct 14 2016
    
Showing 1-10 of 19 results. Next