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

A329200 The ghost iteration (A): add or subtract the number formed by absolute differences of digits (A040115), according to parity (even or odd).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 11, 11, 15, 11, 19, 11, 23, 11, 27, 22, 20, 22, 22, 26, 22, 30, 22, 34, 22, 27, 33, 31, 33, 33, 37, 33, 41, 33, 45, 44, 38, 44, 42, 44, 44, 48, 44, 52, 44, 45, 55, 49, 55, 53, 55, 55, 59, 55, 63, 66, 56, 66, 60, 66, 64, 66, 66, 70, 66, 63, 77, 67, 77, 71, 77
Offset: 0

Views

Author

Eric Angelini and M. F. Hasler, Nov 09 2019

Keywords

Comments

Sequence A040115 is most naturally extended to 0 (empty sum) for single-digit arguments; that's what we use here. This value is added to n if even, subtracted if odd.
Repdigit numbers are the fixed points. Other starting values end in nontrivial loops under iterations of this map, like 11090 -> 10891 -> 12709 -> 11130 -> 11107 -> 11090 etc. Table A329196 lists these cycles, A329197 their lengths.
A329198 gives the size of n's orbit, i.e., the length of the trajectory until the terminating cycle is covered.

Examples

			For n = 101, the number formed by the absolute differences of digits is 11, since this is odd it is subtracted from n, so a(101) = 101-11 = 90.
		

Crossrefs

Cf. A040115, A329201 (variant B: add/subtract if odd/even).
Cf. A329196 (cycles), A329197 (lengths), A329198 (size of orbit of n).

Programs

  • PARI
    apply( A329200(n)={n+(-1)^(n=fromdigits(abs((n=digits(n+!n))[^-1]-n[^1])))*n}, [1..199])

Formula

a(n) = n + (-1)^d*d where d = A040115(n), 0 for n < 10.

A329197 Length of the n-th nontrivial cycle of the "ghost iteration" A329200.

Original entry on oeis.org

5, 6, 3, 7, 5, 9, 6, 3, 3, 5, 3, 3, 6, 3, 3, 3, 5, 3, 3, 6, 3, 3, 3, 3, 5, 3, 3, 6, 3, 17, 3, 11, 3, 3, 3, 5, 3, 3, 6, 6, 3, 17, 3, 3, 3, 3, 5, 7, 6
Offset: 1

Views

Author

M. F. Hasler, Nov 10 2019

Keywords

Comments

A329200 consists in adding or subtracting the number A040115(n) whose digits are the differences of adjacent digits of n, depending on its parity.
Repdigits A010785 are fixed points of this map, but some numbers enter nontrivial cycles. This sequence gives the length of these cycles, ordered by their smallest member, as they are listed in the table A329196. See there for more information.

Examples

			The first cycle of A329200 is row 1 of A329196, (8290, 8969, 9102), of length 3 = a(1).
The second cycle of A329200 is row 2 of A329196, (17998, 24199, 21819, 20041, 22084, 21800, 20020), of length 7 = a(2).
		

Crossrefs

Cf. A329196, A329200, A329198, A329342 (variant using A329201).

Programs

  • PARI
    /* change T to #T in print statement of code for A329196 */

Extensions

a(9)-a(35) from Scott R. Shannon, Nov 12 2019
a(36)-a(49) from Lars Blomberg, Nov 15 2019

A329196 Irregular table whose rows are the nontrivial cycles of the ghost iteration A329200, ordered by increasing smallest member, always listed first.

Original entry on oeis.org

10891, 12709, 11130, 11107, 11090, 43600, 44960, 45496, 44343, 44232, 44021, 74780, 78098, 76207, 75800, 78180, 79958, 77915, 78199, 79979, 82001, 110891, 112709, 111130, 111107, 111090, 180164, 258316, 224791, 227119, 232727, 221172, 220107, 217990, 201781
Offset: 1

Views

Author

M. F. Hasler, Nov 10 2019

Keywords

Comments

A329200 consists of adding the number whose digits are the absoute values of differences of adjacent digits of n in case it is even, or subtracting it if it is odd. Repdigits A010785 are fixed points of this map, but some numbers enter nontrivial cycles. This sequence lists these cycles, ordered by their smallest member which is always listed first. Sequence A329197 gives the row lengths.
Whenever all terms of a cycle have the same number of digits and same initial digit, then this digit can be prefixed k times to each term to obtain a different cycle of same length, for any k >= 0. (The corresponding "ghosts" A040115(n) are then the same, so the (cyclic) first differences are also the same and add again up to 0.) This is the case for rows 1, 2, 3, ... (but not row 4 or 6) of this table. Rows 5, 7 and 8 are the second members of these three families. We could call "primitive" the cycles which are not obtained from an earlier cycle by duplicating the initial digits.

Examples

			The table starts:
   n |  cycle #n  (length = A329197(n))
  ---+-----------------------------------------------------------------------
   1 |  10891,  12709,  11130,  11107,  11090
   2 |  43600,  44960,  45496,  44343,  44232,  44021
   3 |  74780,  78098,  76207
   4 |  75800,  78180,  79958,  77915,  78199,  79979, 82001
   5 | 110891, 112709, 111130, 111107, 111090
   6 | 180164, 258316, 224791, 227119, 232727, 221172, 220107, 217990, 201781
   7 | 443600, 444960, 445496, 444343, 444232, 444021
   8 | 774780, 778098, 776207
   9 | 858699, 891929, 873052
  10 | 1110891, 1112709, 1111130, 1111107, 1111090
  11 | 3270071, 3427147, 3301514
  12 | 4381182, 4538258, 4412625
  13 | 4443600, 4444960, 4445496, 4444343, 4444232, 4444021
  14 | 5492293, 5649369, 5523736
  15 | 7774780, 7778098, 7776207
  16 | 8858699, 8891929, 8873052
  17 | 11110891, 11112709, 11111130, 11111107, 11111090
  18 | 33270071, 33427147, 33301514
  19 | 44381182, 44538258, 44412625
  20 | 44443600, 44444960, 44445496, 44444343, 44444232, 44444021
  21 | 55492293, 55649369, 55523736
  22 | 77774780, 77778098, 77776207
  23 | 85869922, 89192992, 87305285
  24 | 88858699, 88891929, 88873052
  25 | 111110891, 111112709, 111111130, 111111107, 111111090
  26 | 333270071, 333427147, 333301514
  27 | 444381182, 444538258, 444412625
  28 | 444443600, 444444960, 444445496, 444444343, 444444232, 444444021
  29 | 555492293, 555649369, 555523736
  30 | 615930235, 670393447, 653027344, 665352754, 664129233, 666446943,
     | 666244592, 665824445, 664462444, 666486644, 666728664, 666884866,
     | 667089286, 668871048, 670887192, 653085505, 640702450
  31 | 777774780, 777778098, 777776207
  32 | 809513051, 898955405, 887815260, 888989606, 889100972, 887290047,
     | 885711004, 888971108, 889097126, 891089740, 909270974
  33 | 858699257, 891929989, 873052978
  34 | 885869922, 889192992, 887305285
  35 | 888858699, 888891929, 888873052
  36 | 1111110891, 1111112709, 1111111130, 1111111107, 1111111090
  37 | 3333270071, 3333427147, 3333301514
  38 | 4444381182, 4444538258, 4444412625
  39 | 4444443600, 4444444960, 4444445496, 4444444343, 4444444232, 4444444021
  40 | 5461740619, 5587375277, 5618817627, 5461741482, 5587374828, 5618818294
  41 | 5555492293, 5555649369, 5555523736
  42 | 6615930235, 6670393447, 6653027344, 6665352754, 6664129233,
     | 6666446943, 6666244592, 6665824445, 6664462444, 6666486644,
     | 6666728664, 6666884866,
     | 6667089286, 6668871048, 6670887192, 6653085505, 6640702450
  43 | 7777774780, 7777778098, 7777776207
  44 | 8858699257, 8891929989, 8873052978
  45 | 8885869922, 8889192992, 8887305285
  46 | 8888858699, 8888891929, 8888873052
  47 | 11111110891, 11111112709, 11111111130, 11111111107, 11111111090
  48 | 31128941171, 33145094237, 33376689451, 33417710965, 33281649034,
     | 33114123103, 32910811890
  49 | 44444443600, 44444444960, 44444445496, 44444444343,
     | 44444444232, 44444444021
The smallest starting value for which the trajectory under A329200 does not end in a fixed point is n = 8059: This leads into a cycle of length 5, 11090 -> 10891 -> 12709 -> 11130 -> 11107 -> 11090. "Rotated" as to start with the smallest member, this yields the first row of this table, (10891, 12709, 11130, 11107, 11090).
Starting value n = 37908 leads after two steps into the next cycle (44232, 44021, 43600, 44960, 45496, 44343), of length 6. Again "rotating" this list as to start with the smallest member, it yields the second row of this table.
Starting value n = 68060 leads after 8 steps into a new cycle of length 7, (75800, 78180, 79958, 77915, 78199, 79979, 82001). However, this will NOT give row 3 but only row 4, because:
The starting value 70502 leads after 3 steps into the loop (74780, 78098, 76207) which comes lexicographically earlier than the previously mentioned cycle of length 7. Therefore this is row 3 of this table.
Starting value 70515 enters the loop (111090, 110891, 112709, 111130, 111107) after 15 steps. This becomes row 5.
This row 5 is the same as row 1 with the initial digit 1 duplicated in each term: it is the second member of this infinite family of cycles of length 5. Similarly, rows 2 and 3 (where all terms have the same length and initial digit) also lead to infinite families of cycles by successively duplicating the initial digit of each term.
The pattern 858699257(257|857)*84302(302|342)* also yields cycles. - _Lars Blomberg_, Nov 15 2019
		

Crossrefs

Cf. A329197 (row lengths), A329200, A329198.
Cf. A329342 (analog for the variant A329201).

Programs

  • PARI
    T(n,T=[n])={while(!setsearch(Set(T),n=A329200(n)), T=concat(T,n));T} /* trajectory; is a cycle when n is a member of it */
    {U=0; M=[]; for(n=9,oo, bittest(U>>=1,0) && next; if(M && n>M[1], print(T(M[1])); M=M[^1]); t=n; V=U; while( !bittest(U,-n+t=A329200(t)), t>n || next(2); U+=1<<(t-n)); bittest(V,t-n) || #Set(digits(t))==1 || M=setunion(M,[vecmin(T(t))]) )}

Extensions

Rows 9 through 35 from Scott R. Shannon, Nov 12 2019
Table of cycles extended by Lars Blomberg, Nov 15 2019

A329342 Irregular table whose rows list the nontrivial cycles of the ghost iteration A329201, starting with the smallest member.

Original entry on oeis.org

8290, 8969, 9102, 17998, 24199, 21819, 20041, 22084, 21800, 20020, 21901, 23792, 25219, 54503, 55656, 55767, 55978, 56399, 55039, 87290, 88869, 88892, 88909, 89108, 108070, 126947, 141300, 221901, 223792, 225219, 554503, 555656, 555767, 555978, 556399, 555039
Offset: 1

Views

Author

M. F. Hasler, Nov 10 2019

Keywords

Comments

A329201 consists of adding or subtracting the number whose digits are the differences of adjacent digits of n, depending on its parity. Repdigits A010785 are fixed points of this map, but some numbers enter nontrivial cycles.
This sequence lists these cycles, ordered by their smallest member which is always listed first.
Sequence A329341 gives the lengths of these cycles, i.e., rows of this table.
Whenever all terms of a cycle have the same number of digits and same initial digit, then this digit can be prefixed k times to each term to obtain a different cycle of same length, for any k >= 0. (The corresponding "ghosts" A040115(n) are then the same, so the first differences are also the same and add again up to 0.) This is the case for rows 3, 4, 5, 6, ... of this table. Rows 7, 8, 11, ... are subsequent members of the respective family. We could call "primitive" the cycles which are not obtained from an earlier cycle by duplicating the initial digits.

Examples

			The table starts:
   n |  cycle #n  (length = A329341(n))
  ---+------------------------------------------------------------------
   1 |  8290,    8969,   9102
   2 |  17998,  24199,  21819,  20041,  22084,  21800, 20020
   3 |  21901,  23792,  25219
   4 |  54503,  55656,  55767,  55978,  56399,  55039
   5 |  87290,  88869,  88892,  88909,  89108
   6 | 108070, 126947, 141300
   7 | 221901, 223792, 225219
   8 | 554503, 555656, 555767, 555978, 556399, 555039
   9 | 741683, 775208, 772880, 767272, 778827, 779892, 782009, 798218, 819835
  10 | 810001, 881002, 873900, 859210, 893921,
     | 910592, 992139, 985013, 971501, 997952, 1000195, 900011
  11 | 887290, 888869, 888892, 888909, 889108
  12 | 1108070, 1126947, 1141300
  13 | 2221901, 2223792, 2225219
  14 | 4350630, 4476263, 4507706
  15 | 5461741, 5587374, 5618817
  16 | 5554503, 5555656, 5555767, 5555978, 5556399, 5555039
  17 | 6572852, 6698485, 6729928
  18 | 8887290, 8888869, 8888892, 8888909, 8889108
  19 | 9071007, 10047114, 11090717, 10890951
  20 | 10807007, 12694714, 14130077
  21 | 11108070, 11126947, 11141300
  22 | 22221901, 22223792, 22225219
  23 | 44350630, 44476263, 44507706
  24 | 55461741, 55587374, 55618817
  25 | 55554503, 55555656, 55555767, 55555978, 55556399, 55555039
  26 | 66572852, 66698485, 66729928
  27 | 88887290, 88888869, 88888892, 88888909, 88889108
  28 | 90710050, 100471105, 110907120, 108909508
  29 | 98311327, 99831542, 99679130, 99991953, 99983111,
     | 99967911, 99936631, 99873599, 99759359, 99534735, 99113393
  30 | 108070010, 126947021, 141300742
  31 | 110807007, 112694714, 114130077
  32 | 111108070, 111126947, 111141300
  33 | 222221901, 222223792, 222225219
  34 | 329112807, 346914494, 359297549, 384069764, 329606552,
     | 346972655, 334647245, 335870766, 333553056, 333755407,
     | 334175554, 335537555, 333513355, 333271335, 333115133, 332910713, 331128951
  35 | 444350630, 444476263, 444507706
  36 | 555461741, 555587374, 555618817
  37 | 555554503, 555555656, 555555767, 555555978, 555556399, 555555039
  38 | 666572852, 666698485, 666729928
  39 | 829021565, 896942976, 910295697
  40 | 888887290, 888888869, 888888892, 888888909, 888889108
  41 | 998311327, 999831542, 999679130, 999991953, 999983111,
     | 999967911, 999936631, 999873599, 999759359, 999534735, 999113393
		

Crossrefs

Cf. A329341 (row lengths), A329201, A329196 (analog for A329200), A329198.

Programs

  • PARI
    T(n,T=[n])={while(!setsearch(Set(T),n=A329201(n)), T=concat(T,n));T} \\ trajectory; a cycle if n is a member of it.
    {U=0; M=[]; for(n=9, oo, bittest(U>>=1, 0) && next; if(M && n>M[1], print(T(M[1])); M=M[^1]); t=n; V=U; while( !bittest(U, -n+t=A329201(t)), t>n || next(2); U+=1<<(t-n)); bittest(V, t-n) || #Set(digits(t))==1 || M=setunion(M, [vecmin(T(t))]) )}

Extensions

Rows 12 through 41 from Scott R. Shannon, Nov 12 2019

A329341 Length of nontrivial cycles under the ghost iteration A329201, as listed in the table A329342.

Original entry on oeis.org

3, 7, 3, 6, 5, 3, 3, 6, 9, 12, 5, 3, 3, 3, 3, 6, 3, 5, 4, 3, 3, 3, 3, 3, 6, 3, 5, 4, 11, 3, 3, 3, 3, 17, 3, 3, 6, 3, 3, 5, 11
Offset: 1

Views

Author

M. F. Hasler, Nov 10 2019

Keywords

Comments

A329201 consists of adding or subtracting the number A040115(n) whose digits are the difference between adjacent digits of n, depending on its parity. Repdigits A010785 are fixed points of this map, but some numbers enter nontrivial cycles. Sequence A329342 lists these cycles, ordered by their smallest member which is always listed first. This sequence gives the row lengths.

Examples

			a(1) = 3 is the length of the first cycle, (8290, 8969, 9102).
a(2) = 7 is the length of the next cycle, (17998,  24199,  21819,  20041,  22084,  21800, 20020).
a(3) = 3 = a(7) is the length of all members of the family starting with (21901, 23792, 25219) and continued by duplicating the initial digit of each term.
a(4) = 6 = a(8) is the length of all members of the family starting with (54503,  55656,  55767,  55978,  56399,  55039), extended as above.
a(5) = 5 = a(11) is the length of all members of the family starting with (87290,  88869,  88892,  88909,  89108), extended as above.
		

Crossrefs

Cf. A329342 (table of cycles), A329201, A329197 (analog for A329200), A329198.

Extensions

a(12) - a(41) from Scott R. Shannon, Nov 12 2019

A330634 The number of iterations of A330633, the concatenation of the product of adjacent digits, for starting value n before reaching 0, or -1 if this never happens.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Dec 22 2019

Keywords

Comments

This sequence lists the number of iterations required of the sequence A330633, the concatenation of the product of adjacent digits, for starting value n until the resulting term equals zero. If the iterative cycle never reaches zero and instead diverges with larger and larger numbers with each iteration then a(n) = -1.
For larger values of n most starting values lead to a divergent series. The first such term is a(166). See the examples below. This reaches 888 after three iterations which is guaranteed to diverge due to the iterative cycle 888 -> 6464 -> 242424 -> 88888, and the series of 8's expands forever. All starting values examined up to 10^8 either reach zero else eventually contain three or more adjacent 8's and will therefore diverge. Unlike similar iterative sequences A329624 and A329198 there appears to be no fixed points or other cyclic behavior.
Up to n = 10^8 the largest number of iterative steps before reaching zero is 23. This is first seen for n = 3178 and for 18520 other starting values. Considering no larger number of steps was found, nor any during a brief test of random numbers larger than 10^8, it is possible this is the largest number of steps to reach zero for all starting values, with the exception of the repunits comprising k 1's which will take k steps to reach zero. A random number with a large number of digits will almost certainly diverge as it will result in 888, or similar divergent numbers, appearing within the iterative term at some step which, as shown above, will diverge.
There are numbers other than repunits of k 1's which take k steps to reach 0, e.g. n = 691...16 with m 1's where m is odd or 491...16 where m is even has a(n) = m + 17. - Robert Israel, Jul 01 2024

Examples

			a(1) = 1 as A330633(1) = 0, taking 1 iteration to reach 0.
a(11) = 2 as A330633(11) = 1 and A330633(1) = 0, taking 2 iterations to reach 0.
a(77) = 5 as A330633(77) = 49, A330633(49) = 36, A330633(36) = 18, A330633(18) = 8, A330633(8) = 0, taking 5 iterations to reach 0.
a(166) = -1 as A330633(166) = 636, A330633(636) = 1818, A330633(1818) = 888, which is guaranteed to diverge.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local L,i;
      L:= convert(n,base,10);
      if ormap(t -> L[t..t+2] = [8,8,8], [$1..nops(L)-2]) then return -1 fi;
      parse(cat(seq(L[i]*L[i+1],i=nops(L)-1 .. 1, -1)))
    end proc;
    for i from 1 to 9 do f(i):= 0 od:
    g:= proc(i) option remember; local v;
        v:= f(i);
        if v = -1 then -1
        else v:= procname(v);
             if v = -1 then -1 else 1 + v fi
        fi;
    end proc:
    g(0):= 0:
    map(g, [$0..200]); # Robert Israel, Jun 30 2024
  • Mathematica
    Array[If[#[[-1]] == 888, -1, Length@ # - 1] &@ NestWhileList[If[Or[# == 0, IntegerLength@ # == 1], 0, FromDigits[Join @@ IntegerDigits[Times @@ # & /@ Partition[IntegerDigits@ #, 2, 1]]]] &, #, And[# > 0, # != 888] &] &, 102, 0] (* Michael De Vlieger, Dec 23 2019 *)
Showing 1-6 of 6 results.