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.

A261236 a(n) = A261234(n) - A261237(n).

Original entry on oeis.org

0, 1, 3, 7, 16, 40, 104, 279, 758, 2071, 5678, 15609, 43035, 119139, 331616, 928572, 2614743, 7396880, 20999683, 59784414, 170615755, 488073987, 1399625614, 4023315793, 11590737827, 33452982391
Offset: 0

Views

Author

Antti Karttunen, Aug 16 2015

Keywords

Comments

a(n) = How many numbers whose base-3 representation begins with digit "1" are encountered before (3^n)-1 is reached when starting from k = (3^(n+1))-1 and repeatedly applying the map that replaces k by k - (sum of digits in base-3 representation of k).

Examples

			For n=2, we start from 3^(2+1) - 1 = 26 ("222" in base-3), and subtract 6 to get 20 ("202" in base-3), from which we subtract 4, to get 16 ("121" in base-3), from which we subtract 4, to get 12 ("110" in base-3), from which we subtract 2 to get 10 ("101" in base-3), from which we subtract 2 to get 8 ("22" in base-3), which is the end point of iteration. Of the numbers encountered, 16, 12 and 10 have base-3 representations beginning with digit "1", thus a(2) = 3.
		

Crossrefs

Programs

  • C
    /* Use the C-program given in A261234. */
    
  • Mathematica
    Table[Length@ # - First@ FirstPosition[#, k_ /; k != 2] &@ Map[First@ IntegerDigits[#, 3] &, #] &@ NestWhileList[# - Total@ IntegerDigits[#, 3] &, 3^(n + 1) - 1, # > 3^n - 1 &], {n, 0, 16}] (* Michael De Vlieger, Jun 27 2016, Version 10 *)
  • Scheme
    (define (A261236 n) (- (A261234 n) (A261237 n)))

Formula

a(n) = A261234(n) - A261237(n).

Extensions

Terms a(24) & a(25) from Antti Karttunen, Jun 27 2016

A261235 First differences of A261234.

Original entry on oeis.org

1, 3, 7, 17, 45, 122, 334, 915, 2511, 6906, 19039, 52691, 146641, 410734, 1157321, 3276419, 9307640, 26509145, 75669108, 216483760, 620847130, 1784898316, 5143127022, 14847548759, 42923323624, 124213679008, 359730306331, 1042521363580, 3023562595587, 8776718908896, 25502164336020, 74179903571807, 216005883269160, 629644927525768, 1837129499003121, 5364782084798156
Offset: 0

Views

Author

Antti Karttunen, Aug 13 2015

Keywords

Crossrefs

Cf. A261234.
Cf. also A226060.

Programs

Formula

a(n) = A261234(n+1) - A261234(n).

Extensions

Terms from a(23) onward computed from the output of Hiroaki Yamanouchi's program (given in A261234) by Antti Karttunen, Aug 16 2015

A276622 Simple self-inverse permutation of natural numbers: after a(0)=0, list each block of A261234(n) numbers in reverse order, from A261232(n) to A261233(1+n).

Original entry on oeis.org

0, 1, 3, 2, 8, 7, 6, 5, 4, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96
Offset: 0

Views

Author

Antti Karttunen, Sep 11 2016

Keywords

Comments

Maps between A276623 and A276624.

Crossrefs

Programs

Formula

a(0) = 0; for n >= 1, a(n) = A261232(A276621(n)-1) + A261232(A276621(n)) - n - 1.

A276621 After a(0)=0, each n occurs A261234(n-1) times.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Sep 11 2016

Keywords

Comments

Auxiliary function for computing A276622 & A276623.

Crossrefs

After a(0), a(n) differs from A111393(n+1) for the first time at n=46, where a(46)=5, while A111393(47)=6.

Programs

  • Scheme
    (define (A276621 n) (let loop ((k 0)) (if (>= (A261233 k) n) k (loop (+ 1 k)))))

A219661 Number of steps to go from (n+1)!-1 to n!-1 with map x -> x - (sum of digits in factorial base representation of x).

Original entry on oeis.org

1, 2, 5, 19, 83, 428, 2611, 18473, 150726, 1377548, 13851248, 152610108, 1835293041, 23925573979, 335859122743, 5049372125352, 80942722123544, 1378487515335424, 24858383452927384, 473228664468684846
Offset: 1

Views

Author

Antti Karttunen, Dec 03 2012

Keywords

Examples

			(1!)-1 (0) is reached from (2!)-1 (1) with one step by subtracting A034968(1) from 1.
(2!)-1 (1) is reached from (3!)-1 (5) with two steps by first subtracting A034968(5) from 5 -> 2, and then subtracting A034968(2) from 2 -> 1.
(3!)-1 (5) is reached from (4!)-1 (23) with five steps by repeatedly subtracting the sum of digits in factorial expansion as: 23 - 6 = 17, 17 - 5 = 12, 12 - 2 = 10, 10 - 3 = 7, 7 - 2 = 5.
Thus a(1)=1, a(2)=2 and a(3)=5.
		

Crossrefs

Row sums of A230420 and A230421.
Cf. also A213709 (analogous sequence for base-2), A261234 (for base-3).

Programs

  • Mathematica
    Table[Length@ NestWhileList[# - Total@ IntegerDigits[#, MixedRadix[Reverse@ Range[2, 120]]] &, (n + 1)! - 1, # > n! - 1 &] - 1, {n, 0, 8}] (* Michael De Vlieger, Jun 27 2016, Version 10.2 *)
  • Scheme
    (define (A219661 n) (if (zero? n) n (let loop ((i (-1+ (A000142 (1+ n)))) (steps 1)) (cond ((isA000142? (1+ (A219651 i))) steps) (else (loop (A219651 i) (1+ steps)))))))
    (define (isA000142? n) (and (> n 0) (let loop ((n n) (i 2)) (cond ((= 1 n) #t) ((not (zero? (modulo n i))) #f) (else (loop (/ n i) (1+ i)))))))
    ;; Alternative definition:
    (define (A219661 n) (- (A219652 (-1+ (A000142 (1+ n)))) (A219652 (-1+ (A000142 n)))))

Formula

a(n) = A219652((n+1)!-1) - A219652(n!-1).
a(n) = A219662(n) + A219663(n).

Extensions

Terms a(16) - a(20) computed with Hiroaki Yamanouchi's Python-program by Antti Karttunen, Jun 27 2016

A261233 a(n) = number of steps to reach 0 when starting from k = (3^n)-1 and repeatedly applying the map that replaces k with k - (sum of digits in base-3 representation of k).

Original entry on oeis.org

0, 1, 3, 8, 20, 49, 123, 319, 849, 2294, 6250, 17112, 47013, 129605, 358838, 998805, 2796093, 7869800, 22251147, 63141639, 179701239, 512744599, 1466635089, 4205423895, 12087339723, 34816804310, 100469592521, 290336059740, 839932833290, 2432050970420, 7047731703137, 20440131344750, 59334695322383, 172409162871823, 501489513690423, 1460214792034791
Offset: 0

Views

Author

Antti Karttunen, Aug 13 2015

Keywords

Crossrefs

One less than A261232.
Cf. A261234 (the first differences).
Cf. also A218600.

Formula

a(0) = 0; for n >= 1, a(n) = A261234(n-1) + a(n-1).
a(n) = A261231((3^n)-1).
a(n) = A261232(n)-1.

Extensions

Terms from a(24) onward added from the output of Hiroaki Yamanouchi's program by Antti Karttunen, Aug 16 2015

A261231 a(n) = number of steps to reach 0 when starting from k = n and repeatedly applying the map that replaces k with k - (sum of digits in base-3 representation of k).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 12 2015

Keywords

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    def a054861(n): return (n - sum(digits(n, 3)[1:]))/2
    def a(n): return 0 if n==0 else 1 + a(2*a054861(n)) # Indranil Ghosh, May 22 2017

Formula

a(0) = 0; for n >= 1, a(n) = 1 + a(2*A054861(n)). [Note that A054861(n) = (n - A053735(n))/2, where A053735(n) = sum of digits of n, when written in base 3.]

A261230 a(n) = A261236(n) - A261237(n).

Original entry on oeis.org

-1, 0, 1, 2, 3, 6, 12, 28, 71, 186, 494, 1317, 3478, 9045, 23265, 59856, 155779, 412413, 1108874, 3009228, 8188150, 22257484, 60462422, 164715758, 452011067, 1253176571
Offset: 0

Views

Author

Antti Karttunen, Aug 16 2015

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Length@ # - 2 First@ FirstPosition[#, k_ /; k != 2] + 1 &@ Map[First@ IntegerDigits[#, 3] &, #] &@ NestWhileList[# - Total@ IntegerDigits[#, 3] &, 3^(n + 1) - 1, # > 3^n - 1 &], {n, 0, 16}] (* Michael De Vlieger, Jun 27 2016, Version 10 *)
  • Scheme
    (define (A261230 n) (- (A261236 n) (A261237 n)))

Formula

a(n) = A261236(n) - A261237(n).

Extensions

Terms a(24) & a(25) from Antti Karttunen, Jun 27 2016

A261232 a(n) = number of steps to reach 0 when starting from k = 3^n and repeatedly applying the map that replaces k with k - (sum of digits in base-3 representation of k).

Original entry on oeis.org

1, 2, 4, 9, 21, 50, 124, 320, 850, 2295, 6251, 17113, 47014, 129606, 358839, 998806, 2796094, 7869801, 22251148, 63141640, 179701240, 512744600, 1466635090, 4205423896, 12087339724, 34816804311, 100469592522, 290336059741, 839932833291, 2432050970421, 7047731703138, 20440131344751, 59334695322384, 172409162871824, 501489513690424
Offset: 0

Views

Author

Antti Karttunen, Aug 13 2015

Keywords

Crossrefs

One more than A261233.
Cf. also A213710.

Formula

a(0) = 1; for n >= 1, a(n) = A261234(n-1) + a(n-1).
a(n) = A261231(3^n).
a(n) = 1 + A261233(n).

Extensions

Terms from a(24) onward added from the output of Hiroaki Yamanouchi's program by Antti Karttunen, Aug 16 2015

A261237 Number of steps needed when starting from (3^(n+1))-1 and repeatedly applying the map that replaces k with k - (sum of digits in base-3 representation of k) to encounter the first number whose base-3 representation begins with a digit other than 2.

Original entry on oeis.org

1, 1, 2, 5, 13, 34, 92, 251, 687, 1885, 5184, 14292, 39557, 110094, 308351, 868716, 2458964, 6984467, 19890809, 56775186, 162427605, 465816503, 1339163192, 3858600035, 11138726760, 32199805820
Offset: 0

Views

Author

Antti Karttunen, Aug 16 2015

Keywords

Comments

a(n) = How many numbers whose base-3 representation begins with digit "2" are encountered before (3^n)-1 is reached when starting from k = (3^(n+1))-1 and repeatedly applying the map that replaces k by k - (sum of digits in base-3 representation of k). Note that (3^n)-1 (in base-3: "222...", with digit "2" repeated n times) is not included in the count, although the starting point (3^(n+1))-1 is.

Examples

			For n=0, we start from 3^(0+1) - 1 = 2 (also "2" in base-3), and subtract 2 to get 0, which doesn't begin with 2, thus a(0) = 1.
For n=1, we start from 3^(1+1) - 1 = 8 ("22" in base-3), and subtract 2*2 = 4 to get 4 ("11" in base-3) which doesn't begin with 2, thus a(1) = 1.
For n=2, we start from 3^(2+1) - 1 = 26 ("222" in base-3), and subtract first 6 to get 20 ("202" in base-3), from which we subtract 4, to get 16 ("121" in base-3), so in two steps we have reached the first such number that does not begin with "2" in base-3, thus a(2) = 2.
		

Crossrefs

Programs

  • C
    /* Use the C-program given in A261234. */
    
  • Mathematica
    Flatten@ Table[FirstPosition[#, k_ /; k != 2] &@ Map[First@ IntegerDigits[#, 3] &, NestWhileList[# - Total@ IntegerDigits[#, 3] &, 3^(n + 1) - 1, # > 3^n - 1 &]] - 1, {n, 0, 16}] (* Michael De Vlieger, Jun 27 2016, Version 10 *)
  • PARI
    a(n)=my(k=3^(n+1)-1,t=2*3^n,s); while(k>=t, k-=sumdigits(k,3); s++); s \\ Charles R Greathouse IV, Aug 21 2015
  • Scheme
    (definec (A261237 n) (let loop ((k (- (A000244 (+ 1 n)) 1)) (s 0)) (if (< (A122586 k) 2) s (loop (* 2 (A054861 k)) (+ 1 s)))))
    

Extensions

Terms a(24) & a(25) from Antti Karttunen, Jun 27 2016
Showing 1-10 of 10 results.