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.

A355807 a(n) is the number at the apex of a triangle whose base contains the distinct powers of 2 summing to n (in ascending order), and each number in a higher row is the absolute difference of the two numbers directly below it; a(0) = 0.

Original entry on oeis.org

0, 1, 2, 1, 4, 3, 2, 1, 8, 7, 6, 5, 4, 1, 2, 1, 16, 15, 14, 13, 12, 9, 10, 9, 8, 1, 2, 3, 4, 3, 2, 1, 32, 31, 30, 29, 28, 25, 26, 25, 24, 17, 18, 13, 20, 19, 18, 17, 16, 1, 2, 11, 4, 5, 6, 3, 8, 7, 6, 3, 4, 1, 2, 1, 64, 63, 62, 61, 60, 57, 58, 57, 56, 49, 50
Offset: 0

Views

Author

Rémy Sigrist, Jul 18 2022

Keywords

Comments

This sequence has similarities with A334387.

Examples

			For n = 27:
- we have the following triangle:
            3
          5   2
        1   6   8
      1   2   8  16
- so a(27) = 3.
		

Crossrefs

See A355808, A355809, A355810 and A355811 for other variants.

Programs

  • PARI
    a(n) = { my (b=vector(hammingweight(n))); for (k=1, #b, n-=b[k]=2^valuation(n,2)); while (#b>1, b=vector(#b-1, k, abs(b[k+1]-b[k]))); if (#b, b[1], 0) }

Formula

a(n) <= n with equality iff n = 0 or n is a power of 2.
a(2*n) = 2*a(n).

A330859 The additive version of the 'Decade transform' : to obtain a(n) write n as a sum of its power-of-ten parts and then continue to calculate the sum of the adjacent parts until a single number remains.

Original entry on oeis.org

100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 220, 221, 222
Offset: 100

Views

Author

Scott R. Shannon, Apr 28 2020

Keywords

Comments

Due to its construction a(n) = n for n=0..109, thus the data section shows a(n) for n >= 100.
To obtain the additive version of the 'Decade transform' of n first write n as a sum of its power-of-ten parts and then continue to calculate the sum of the adjacent parts until a single number remains. See the Examples for details.
See A334387 for the difference version of the same transform.

Examples

			Let n = 32871. Write n as a sum of its power-of-ten parts:
32871 = 30000+2000+800+70+1
Now take the sum of adjacent numbers in this sum:
30000+2000+800+70+1 -> (30000+2000):(2000+800):(800+70):(70+1) = 32000:2800:870:71
Now repeat this until a single number remains:
32000:2800:870:71 -> 34800:3670:941
34800:3670:941 -> 38470:4611
38470:4611 -> 43081
Thus a(32871) = 43081.
Other examples:
a(100) = 100 as 100 = 100+0+0 thus 100:0:0 -> 100:0 -> 100. The equality a(n) = n holds for n=0 to 109.
a(110) = 120 as 110 = 100+10+0 thus 100:10:0 -> 110:10 -> 120.
a(1234) = 1694 as 1234 = 1000+200+30+4 thus 1000:200:30:4 -> 1200:230:34 -> 1430:264 -> 1694.
a(15010) = 30040 as 15010 = 10000+5000+0+10+0 thus 10000:5000:0:10:0 -> 15000:5000:10:10 -> 20000:5010:20 -> 25010:5030 -> 30040.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Block[{d = IntegerDigits[n], m}, m = Length[d] - 1; Total[d Binomial[ m, Range[0, m]] 10^Range[m, 0, -1]]]; a /@ Range[100, 162] (* Giovanni Resta, May 09 2020 *)

Formula

Let d_m,d_(m-1),..,d_1,d_0 be the m decimal digits of n, then a(n) = Sum_{k=0..m} d_k*C(m,k)*10^k. - Giovanni Resta, May 09 2020

A355675 a(0) = 0, and for any n > 0 and d = 1..9, a(10*n) = 10*a(n), a(10*n + d) = d - 10*a(n).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 20, -19, -18, -17, -16, -15, -14, -13, -12, -11, 30, -29, -28, -27, -26, -25, -24, -23, -22, -21, 40, -39, -38, -37, -36, -35, -34, -33, -32, -31, 50, -49, -48, -47, -46, -45, -44, -43, -42
Offset: 0

Views

Author

Rémy Sigrist, Jul 14 2022

Keywords

Comments

This sequence establishes a bijection from the nonnegative integers (N) to the integers (Z).
This sequence is to base 10 what A065620 is to base 2.
To compute a(n): write n a sum of terms of A037124 with distinct 10-adic valuations and take the alternating sum.
This sequence has similarities with A073835; they first differ in absolute value for n = 101: a(101) = 99 whereas A073835(101) = 101.
This sequence has similarities with A334387; they first differ in absolute value for n = 111: a(111) = 91 whereas A334387(111) = 81.

Examples

			For n = 17039:
  17039 = 10000 + 7000 + 30 + 9,
  so a(17039) = -10000 + 7000 - 30 + 9 = -3021.
		

Crossrefs

Programs

  • PARI
    a(n, base=10) = { my (d=digits(n, base), s=1); forstep (k=#d, 1, -1, if (d[k], d[k]*=s; s=-s)); return (fromdigits(d, base)) }

Formula

a(n) = 0 iff n = 0 or n belongs to A037124.
Showing 1-3 of 3 results.