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

A364380 Numbers k such that k and k+1 are both greedy Jacobsthal-Niven numbers (A364379).

Original entry on oeis.org

1, 2, 3, 4, 5, 8, 9, 10, 11, 14, 15, 20, 21, 26, 27, 32, 42, 43, 44, 45, 51, 56, 68, 75, 84, 85, 86, 87, 92, 99, 104, 105, 111, 115, 116, 125, 128, 135, 144, 155, 170, 171, 176, 182, 183, 195, 204, 213, 219, 224, 260, 264, 267, 275, 304, 305, 324, 329, 341, 344
Offset: 1

Views

Author

Amiram Eldar, Jul 21 2023

Keywords

Comments

The positive Jacobsthal numbers, A001045(n) for n >= 1, are terms since their representation in Jacobsthal greedy base is one 1 followed by n-1 0's, so A265745(A001045(n)) = 1 divides A001045(n), and the representation of A001045(n) + 1 is 2 if n <= 2 and otherwise n-3 0's between two 1's, so A265745(A001045(n) + 1) = 2 which divides A001045(n) + 1.

Crossrefs

Programs

  • Mathematica
    consecGreedyJN[kmax_, len_] := Module[{m = 1, c = Table[False, {len}], s = {}}, Do[c = Join[Rest[c], {greedyJacobNivenQ[k]}]; If[And @@ c, AppendTo[s, k - len + 1]], {k, 1, kmax}]; s]; consecGreedyJN[350, 2] (* using the function greedyJacobNivenQ[n] from A364379 *)
  • PARI
    lista(kmax, len) = {my(c = vector(len)); for(k = 1, kmax, c = concat(vecextract(c, "^1"), isA364379(k)); if(vecsum(c) == len, print1(k-len+1, ", ")));} \\ using the function isA364379(n) from A364379
    lista(350, 2)

A364383 Starts of runs of 5 consecutive integers that are greedy Jacobsthal-Niven numbers (A364379).

Original entry on oeis.org

1, 2, 8, 42, 84, 2730, 5460, 21864, 174762, 349524, 8575060, 11184810, 89478504, 106502227, 109295017, 181276927, 181843540, 184069717, 223830100, 245705471, 279956051, 280652201, 287571966, 291006547, 316295081, 316991231, 358660180, 360195667, 362988457, 422527571
Offset: 1

Views

Author

Amiram Eldar, Jul 21 2023

Keywords

Comments

Is 1 the only start of a run of 6 consecutive integers that are greedy Jacobsthal-Niven numbers?

Crossrefs

Subsequence of A364379, A364380, A364381 and A364382.
Similar sequences: A330928, A364220.

Programs

  • Mathematica
    consecGreedyJN[2*10^5, 5] (* using the function consecGreedyJN from A364380 *)
  • PARI
    lista(2*10^5, 5) \\ using the function lista from A364380

A364381 Starts of runs of 3 consecutive integers that are greedy Jacobsthal-Niven numbers (A364379).

Original entry on oeis.org

1, 2, 3, 4, 8, 9, 10, 14, 20, 26, 42, 43, 44, 84, 85, 86, 104, 115, 170, 182, 304, 344, 362, 414, 544, 682, 686, 692, 784, 854, 1014, 1370, 1384, 1504, 1673, 1685, 1706, 2224, 2315, 2358, 2730, 2731, 2732, 2763, 2774, 3243, 3594, 3702, 4144, 4688, 4864, 5046, 5408
Offset: 1

Views

Author

Amiram Eldar, Jul 21 2023

Keywords

Crossrefs

Programs

  • Mathematica
    consecGreedyJN[5500, 3] (* using the function consecGreedyJN from A364380 *)
  • PARI
    lista(5500, 3) \\ using the function lista from A364380

A364382 Starts of runs of 4 consecutive integers that are greedy Jacobsthal-Niven numbers (A364379).

Original entry on oeis.org

1, 2, 3, 8, 9, 42, 43, 84, 85, 2730, 2731, 5460, 5461, 21864, 21865, 59477, 60073, 66303, 75048, 112509, 156607, 174762, 174763, 283327, 312190, 320768, 349524, 349525, 351570, 354429, 374589, 384039, 479037, 504510, 527103, 624040, 625470, 656829, 688830, 711423
Offset: 1

Views

Author

Amiram Eldar, Jul 21 2023

Keywords

Crossrefs

Subsequence of A364379, A364380 and A364381.
A364383 is a subsequence.

Programs

  • Mathematica
    consecGreedyJN[72000, 4] (* using the function consecGreedyJN from A364380 *)
  • PARI
    lista(10^5, 4) \\ using the function lista from A364380

A265745 a(n) is the number of Jacobsthal numbers (A001045) needed to sum to n using the greedy algorithm.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 17 2015

Keywords

Comments

Sum of digits in "Jacobsthal greedy base", A265747.
It would be nice to know for sure whether this sequence gives also the least number of Jacobsthal numbers that add to n, i.e., that there cannot be even better nongreedy solutions.
The integer 63=21+21+21 has 3 for its 'non-greedy' solution, and a(63) = 5 for its greedy solution 63=43+11+5+3+1. - Yuriko Suwa, Jul 11 2021
Positions where a(n) is different from A372555(n) are n=63, 84, 148, 169, 191, 212, 234, 255, etc. See A372557. - Antti Karttunen, May 07 2024

Examples

			a(0) = 0, because no numbers are needed to form an empty sum, which is zero.
For n=1 we need just A001045(2) = 1, thus a(1) = 1.
For n=2 we need A001045(2) + A001045(2) = 1 + 1, thus a(2) = 2.
For n=4 we need A001045(3) + A001045(2) = 3 + 1, thus a(4) = 2.
For n=6 we form the greedy sum as A001045(4) + A001045(2) = 5 + 1, thus a(6) = 2. Alternatively, we could form the sum as A001045(3) + A001045(3) = 3 + 3, but the number of summands in that case is no less.
For n=7 we need A001045(4) + A001045(2) + A001045(2) = 5 + 1 + 1, thus a(7) = 3.
For n=8 we need A001045(4) + A001045(3) = 5 + 3, thus a(8) = 2.
For n=10 we need A001045(4) + A001045(4) = 5 + 5, thus a(10) = 2.
		

Crossrefs

Cf. A054111 (apparently the positions of the first occurrence of each n > 0).

Programs

  • Mathematica
    jacob[n_] := (2^n - (-1)^n)/3; maxInd[n_] := Floor[Log2[3*n + 1]]; A265745[n_] := A265745[n] = 1 + A265745[n - jacob[maxInd[n]]]; A265745[0] = 0; Array[A265745, 100, 0] (* Amiram Eldar, Jul 21 2023 *)
  • PARI
    A130249(n) = floor(log(3*n + 1)/log(2));
    A001045(n) = (2^n - (-1)^n) / 3;
    A265745(n) = {if(n == 0, 0, my(d = n - A001045(A130249(n))); if(d == 0, 1, 1 + A265745(d)));} \\ Amiram Eldar, Jul 21 2023
  • Python
    def greedyJ(n): n1 = (3*n+1).bit_length() - 1; return (2**n1 - (-1)**n1)//3
    def a(n): return 0 if n == 0 else 1 + a(n - greedyJ(n))
    print([a(n) for n in range(107)]) # Michael S. Branicky, Jul 11 2021
    

Formula

a(0) = 0; for n >= 1, a(n) = 1 + a(n - A001045(A130249(n))). [This formula uses a simple greedy algorithm.]
Showing 1-5 of 5 results.