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

A372288 Array read by upward antidiagonals: A(n, k) = A265745(A372282(n, k)), n,k >= 1, where A265745(n) is the sum of digits in "Jacobsthal greedy base".

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 3, 1, 1, 1, 3, 3, 1, 1, 1, 1, 3, 3, 3, 3, 1, 1, 1, 1, 3, 3, 1, 3, 1, 1, 1, 1, 3, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 5, 3, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 5, 3
Offset: 1

Views

Author

Antti Karttunen, Apr 28 2024

Keywords

Comments

Collatz conjecture is equal to the claim that each column will eventually settle to constant 1's, somewhere under its topmost row. This works as only the bisection A002450 of Jacobsthal numbers (A001045) contains numbers of the form 4k+1, while the other bisection contains only numbers of the form 4k+3, which do not occur among the range of A372351. See also the comments in A371094.

Examples

			Array begins:
n\k| 1  2  3  4  5  6  7  8  9 10 11 12 13     14 15    16 17 18 19 20    21 22
---+----------------------------------------------------------------------------
1  | 1, 1, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3,     3, 3,    3, 3, 3, 3, 5,    5, 1,
2  | 1, 1, 1, 3, 3, 3, 1, 3, 3, 3, 1, 5, 5,     5, 3,    5, 3, 3, 3, 5,    5, 3,
3  | 1, 1, 1, 3, 3, 3, 1, 5, 1, 3, 1, 3, 3,     5, 3,    5, 5, 1, 3, 3,    5, 3,
4  | 1, 1, 1, 3, 3, 1, 1, 3, 1, 3, 1, 1, 3,     5, 3,    3, 3, 1, 3, 5,    5, 3,
5  | 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 3,     5, 1,    5, 3, 1, 3, 3,    3, 3,
6  | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,     3, 1,    5, 3, 1, 1, 5,    5, 3,
7  | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,     5, 1,    3, 3, 1, 1, 3,    5, 3,
8  | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,     5, 1,    5, 1, 1, 1, 3,    3, 3,
9  | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,     3, 1,    5, 1, 1, 1, 3,    5, 1,
10 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,     5, 1,    5, 1, 1, 1, 3,    5, 1,
11 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,     5, 1, 2155, 1, 1, 1, 1,    5, 1,
12 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,     5, 1,    5, 1, 1, 1, 1, 6251, 1,
13 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10347, 1,    5, 1, 1, 1, 1,    5, 1,
14 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,     5, 1,    5, 1, 1, 1, 1,    5, 1,
15 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,     5, 1,    7, 1, 1, 1, 1,    5, 1,
16 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,     5, 1,    5, 1, 1, 1, 1,    7, 1,
		

Crossrefs

Cf. also array A372561 (formed by columns whose indices in this array are given by A372443).

Programs

A372557 Numbers k such that the least number of Jacobsthal numbers that add up to k, A372555(k), is less than the number needed with the greedy algorithm, A265745(k).

Original entry on oeis.org

63, 84, 148, 169, 191, 212, 234, 255, 276, 297, 319, 340, 404, 425, 489, 510, 532, 553, 575, 596, 617, 638, 660, 681, 703, 724, 746, 767, 788, 809, 831, 852, 874, 895, 917, 937, 938, 959, 980, 1002, 1022, 1023, 1044, 1065, 1087, 1108, 1129, 1150, 1172, 1193, 1215, 1236, 1258, 1278, 1279, 1300, 1321, 1343, 1363, 1364, 1428
Offset: 1

Views

Author

Antti Karttunen, May 07 2024

Keywords

Examples

			63 = 21+21+21 has A372555(63)=3 for its optimal, non-greedy solution, and A265745(63) = 5 for its greedy solution 63 = 43+11+5+3+1, therefore 63 is included in this sequence. (From _Yuriko Suwa_'s Jul 11 2021 comment in A265745.)
84 = 21+21+21+21 has A372555(84)=4 for its optimal, non-greedy solution, and A265745(84) = 6 for its greedy solution 84 = 43+21+11+5+3+1, therefore 84 is included in this sequence.
169 = 85+21+21+21+21 has A372555(169)=5 for its optimal, non-greedy solution, and A265745(169) = 7 for its greedy solution 169 = 85+43+21+11+5+3+1, therefore 169 is included in this sequence.
		

Crossrefs

Cf. A372558 (subsequence).

Programs

A372561 Array read by upward antidiagonals: A(n, k) = A265745(A372560(n, k)) for n > 1, k >= 1.

Original entry on oeis.org

3, 5, 5, 5, 5, 3, 5, 5, 5, 3, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10347, 6251, 2155, 1131, 619, 363, 235, 107, 43, 27, 11, 7, 5
Offset: 1

Views

Author

Antti Karttunen, May 08 2024

Keywords

Comments

In general, it seems that for n>2, k>1, A(n, k) = A(n-1, k+1) = A(k, n), except on those two anomalous antidiagonals, first on the thirteenth antidiagonal, where for n=1..13, A(n,14-n) obtains values 5, 7, 11, 27, 43, 107, 235, 363, 619, 1131, 2155, 6251, 10347, and then on the 30th antidiagonal, where for n=1.., A(n,31-n) obtains values 5, 11, 15, 23, 39, 71, 135, 391, 647, 1671, 2695, 4743, 17031, 33415, 49799, 82567, 148103, 410247, etc. The corresponding antidiagonals in A372560 begin as:
233, 933, 14933, 978670933, 64138178286933, 1183140560213014108063589658350933, ..., and:
911, 58325, 933205, 238900565, 15656587449685, 67244531063362552157525, etc. I conjecture that for the former sequence of numbers x, from 933 onward, A372555(x) = 7, and for the latter sequence of numbers y, from 58325 onward, A372555(y) = 9, and that the array A372555(A372560(n, k)) is symmetric apart from its borders, i.e, that for n, k > 1, A372555(A372560(n, k)) = A372555(A372560(k, n)).

Examples

			Array begins:
n\k| 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21
---+----------------------------------------------------------------
1  | 3, 5, 3, 3, 5, 3, 5, 5, 3, 5, 5, 5, 5, 3, 5, 3, 7, 5, 7, 5, 5,
2  | 5, 5, 5, 5, 3, 5, 5, 3, 5, 5, 5, 7, 5, 5, 5, 7, 5, 7, 7, 5, 5,
3  | 5, 5, 5, 3, 5, 5, 3, 5, 5, 5, 11, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7,
4  | 5, 5, 3, 5, 5, 3, 5, 5, 5, 27, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9,
5  | 5, 3, 5, 5, 3, 5, 5, 5, 43, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7,
6  | 3, 5, 5, 3, 5, 5, 5, 107, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7, 7,
7  | 5, 5, 3, 5, 5, 5, 235, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7, 7, 7,
8  | 5, 3, 5, 5, 5, 363, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7, 7, 7, 9,
9  | 3, 5, 5, 5, 619, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7, 7, 7, 9, 7,
10 | 5, 5, 5, 1131, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7, 7, 7, 9, 7, 1671,
11 | 5, 5, 2155, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7, 7, 7, 9, 7, 2695, 3,
12 | 5, 6251, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7, 7, 7, 9, 7, 4743, 3, 5,
13 | 10347, 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7, 7, 7, 9, 7, 17031, 3, 5, 3,
14 | 5, 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7, 7, 7, 9, 7, 33415, 3, 5, 3, 5,
15 | 5, 5, 7, 5, 7, 7, 5, 5, 7, 9, 7, 7, 7, 9, 7, 49799, 3, 5, 3, 5, 5,
etc.
From column 19 to column 41, the first 11 rows:
n\k|19 20 ........................................................... 40 41
---+-------------------------------------------------------------------------
1  | 7, 5, 5, 5, 7, 7, 5, 5, 5, 7, 7, 5,    3, 3, 3, 5, 5, 5, 5, 3, 3, 3, 1,
2  | 7, 5, 5, 7, 9, 7, 7, 7, 9, 7, 11,   3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 1, 1,
3  | 5, 5, 7, 9, 7, 7, 7, 9, 7, 15,   3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 1, 1, 1,
4  | 5, 7, 9, 7, 7, 7, 9, 7, 23,   3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 1, 1, 1, 1,
5  | 7, 9, 7, 7, 7, 9, 7, 39,   3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 1, 1, 1, 1, 1,
6  | 9, 7, 7, 7, 9, 7, 71,   3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 1, 1, 1, 1, 1, 1,
7  | 7, 7, 7, 9, 7, 135,  3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 1, 1, 1, 1, 1, 1, 1,
8  | 7, 7, 9, 7, 391,  3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1,
9  | 7, 9, 7, 647,  3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
10 | 9, 7, 1671, 3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
11 | 7, 2695, 3, 5, 3, 5, 5, 5, 5, 3, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
		

Crossrefs

Programs

A265747 Numbers written in Jacobsthal greedy base.

Original entry on oeis.org

0, 1, 2, 10, 11, 100, 101, 102, 110, 111, 200, 1000, 1001, 1002, 1010, 1011, 1100, 1101, 1102, 1110, 1111, 10000, 10001, 10002, 10010, 10011, 10100, 10101, 10102, 10110, 10111, 10200, 11000, 11001, 11002, 11010, 11011, 11100, 11101, 11102, 11110, 11111, 20000, 100000, 100001, 100002, 100010, 100011, 100100
Offset: 0

Views

Author

Antti Karttunen, Dec 17 2015

Keywords

Comments

These are called "Jacobsthal Representation Numbers" in Horadam's 1996 paper.
Sum_{i=0..} digit(i)*A001045(2+digit(i)) recovers n from such representation a(n), where digit(0) stands for the least significant digit (at the right), and A001045(k) gives the k-th Jacobsthal number.
No larger digits than 2 will occur, which allows representing the same sequence in a more compact form by base-3 coding in A265746.
Sequence A197911 gives the terms with no digit "2" in their representation, while its complement A003158 gives the terms where "2" occurs at least once.
Numbers beginning with digit "2" in this representation are given by A020988(n) [= 2*A002450(n) = 2*A001045(2n)].

Examples

			For n=7, when selecting the terms of A001045 with the greedy algorithm, we need terms A001045(4) + A001045(2) + A001045(2) = 5 + 1 + 1, thus a(7) = "102".
For n=10, we need A001045(4) + A001045(4) = 5+5, thus a(10) = "200".
		

Crossrefs

Cf. A265745 (sum of digits).
Cf. A265746 (same numbers interpreted in base-3, then shown in decimal).
Cf. A084639 (positions of repunits).
Cf. A007961, A014417, A014418, A244159 for analogous sequences.

Programs

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

Formula

a(0) = 0; for n >= 1, a(n) = 10^(A130249(n)-2) + a(n-A001045(A130249(n))).
a(n) = A007089(A265746(n)).

A265744 a(n) is the number of Pell numbers (A000129) needed to sum to n using the greedy algorithm (A317204).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 17 2015

Keywords

Comments

a(0) = 0, because no numbers are needed to form an empty sum, which is zero.
It would be nice to know for sure whether this sequence also gives the least number of Pell numbers that add to n, i.e., that there cannot be even better nongreedy solutions.

References

  • A. F. Horadam, Zeckendorf representations of positive and negative integers by Pell numbers, Applications of Fibonacci Numbers, Springer, Dordrecht, 1993, pp. 305-316.

Crossrefs

Similar sequences: A007895, A116543, A278043.

Programs

  • Mathematica
    pell[1] = 1; pell[2] = 2; pell[n_] := pell[n] = 2*pell[n - 1] + pell[n - 2]; a[n_] := Module[{s = {}, m = n, k}, While[m > 0, k = 1; While[pell[k] <= m, k++]; k--; AppendTo[s, k]; m -= pell[k]; k = 1]; Plus @@ IntegerDigits[Total[3^(s - 1)], 3]]; Array[a, 100, 0] (* Amiram Eldar, Mar 12 2022 *)

Formula

a(n) = A007953(A317204(n)). - Amiram Eldar, Mar 12 2022

A276328 Digit sum when n is expressed in greedy A001563-base (A276326).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 30 2016

Keywords

Comments

a(n) is the number of terms of A001563 needed to sum to n using the greedy algorithm.
This seems to give also the minimal number of terms of A001563 that sum to n (checked empirically up to n=3265920), but it would be nice to know for sure whether this holds for all n.

Examples

			For n=1, the largest term of A001563 <= 1 is A001563(1) = 1, thus a(1) = 1.
For n=2, the largest term of A001563 <= 2 is A001563(1) = 1, thus a(2) = 1 + a(2-1) = 2.
For n=18, the largest term of A001563 <= 18 is A001563(3) = 18, thus a(18) = 1.
For n=20, the largest term of A001563 <= 20 is A001563(3) = 18, thus a(20) = 1 + a(20-18) = 3.
For n=36, the largest term of A001563 <= 36 is A001563(3) = 18, thus a(36) = 1 + a(18) = 2.
		

Crossrefs

Cf. A276091 (gives all n for which a(n) = A276337(n)).
Cf. also A007895, A034968, A265744, A265745 for similar sequences.

Programs

  • Mathematica
    f[n_] := Block[{a = {{0, n}}}, Do[AppendTo[a, {First@ #, Last@ #} &@ QuotientRemainder[a[[-1, -1]], (# #!) &[# - i]]], {i, 0, # - 1}] &@NestWhile[# + 1 &, 0, (# #!) &[# + 1] <= n &]; Rest[a][[All, 1]]]; {0}~Join~Table[Total@ f@ n, {n, 120}] (* Michael De Vlieger, Aug 31 2016 *)

Formula

a(0) = 0; for n >= 1, a(n) = 1 + a(n-A258199(n)).
a(0) = 0; for n >= 1, a(n) = A276333(n) + a(A276335(n)).
Other identities and observations. For all n >= 0:
a(A276091(n)) = A000120(n).
a(n) >= A276337(n).
It also seems that a(n) <= A276332(n) for all n.

A364379 Greedy Jacobsthal-Niven numbers: numbers that are divisible by the sum of the digits in their representation in Jacobsthal greedy base (A265747).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 14, 15, 16, 20, 21, 22, 24, 26, 27, 28, 32, 33, 36, 40, 42, 43, 44, 45, 46, 48, 51, 52, 54, 56, 57, 60, 64, 68, 69, 72, 75, 76, 80, 84, 85, 86, 87, 88, 90, 92, 93, 96, 99, 100, 104, 105, 106, 108, 111, 112, 115, 116, 117, 120
Offset: 1

Views

Author

Amiram Eldar, Jul 21 2023

Keywords

Comments

Numbers k such that A265745(k) | k.
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).

Crossrefs

Programs

  • Mathematica
    greedyJacobNivenQ[n_] := Divisible[n, A265745[n]]; Select[Range[120], greedyJacobNivenQ] (* using A265745[n] *)
  • PARI
    isA364379(n) = !(n % A265745(n)); \\ using A265745(n)

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

A372555 Least number of Jacobsthal numbers that add up to n.

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, 3, 2, 3, 4, 3, 4, 3, 4, 5, 4, 5, 4, 3, 4, 5, 4, 5, 4, 5, 6, 5, 4, 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, May 07 2024

Keywords

Comments

Differs from A265745 for the first time at n=63, where a(63) = 3, while A265745(63) = 5. The next differences occur at n=84, 148, 169, 191, 212, 234, 255, etc. See A372557.
See conjecture in A372556, and also in A372561.

Examples

			a(5) = 1, because 5 is itself in A001045.
a(7) = 3, because 7 can be expressed as a sum of three Jacobsthal numbers, either as 5+1+1 or 3+3+1, but not as a sum of two Jacobsthal numbers, and neither 7 is itself in A001045.
a(63) = 3, because the least number of Jacobsthal numbers that add up to 63 is obtained when we use A001045(6) = 21 three times, as 21+21+21 = 63. This is the first time this sequence differs from A265745.
		

Crossrefs

Programs

  • PARI
    up_to = 87381; \\ = A001045(18).
    A001045(n) = (2^n - (-1)^n) / 3;
    A130249(n) = (#binary(3*n+1)-1);
    A372555_or_556list(up_to_n,return_556_instead) = { my(v372555 = vector(up_to_n), v372556 = vector(up_to_n)); v372555[1] = 1; v372556[1] = 2; for(n=2,#v372556, my(m=-1,mk=-1,s=A130249(n)); if(A001045(s)==n, v372555[n] = 1; v372556[n] = s, forstep(k=s, 1, -1, my(c=v372555[n-A001045(k)]); if(m<0 || cA001045(mk)])); if(return_556_instead,v372556,v372555); };
    v372555 = A372555_or_556list(up_to,0);
    A372555(n) = if(!n,n,v372555[n]);
    
  • Scheme
    ;; An implementation of memoization-macro definec can be found for example in: http://oeis.org/wiki/Memoization
    (definec (A001045 n) (if (<= n 1) n (+ (A001045 (- n 1)) (* 2 (A001045 (- n 2))))))
    (define (A130249 n) (floor->exact (/ (log (+ 1 (* 3 n))) (log 2))))
    (define (A147612 n) (if (<= n 1) 1 (if (= (A001045 (A130249 n)) n) 1 0)))
    (definec (A372555 n) (if (<= n 1) n (+ 1 (A372555 (- n (A001045 (A372556 n)))))))
    (definec (A372556 n) (let ((k (A130249 n))) (if (= 1 (A147612 n)) k (let loop ((k k) (m #f) (mk #f)) (cond ((zero? k) mk) (else (let* ((c (A372555 (- n (A001045 k))))) (if (or (not m) (< c m)) (loop (- k 1) c k) (loop (- k 1) m mk)))))))))

Formula

a(0) = 0, a(1) = 1; for n > 1, a(n) = 1 + a(n-A001045(A372556(n))).
Showing 1-10 of 16 results. Next