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.

User: Carl R. White

Carl R. White's wiki page.

Carl R. White has authored 100 sequences. Here are the ten most recent ones:

A375009 a(n) = smallest prime Q of a consecutive prime triple {P, Q, R} such that floor( (R-Q) * (Q-P) / 8 ) = n.

Original entry on oeis.org

7, 139, 23, 53, 1151, 89, 113, 10007, 509, 331, 91079, 479, 541, 79699, 631, 1129, 293, 211, 5557, 265621, 2633, 1259, 1599709, 3659, 1327, 2127269, 4703, 1847, 1349533, 4201, 7621, 16519, 2579, 41333, 10343761, 4621, 4327, 8039, 16729, 3433, 166209301, 3271, 44351
Offset: 1

Author

Carl R. White, Jul 27 2024

Keywords

Comments

Without taking the floor there is no such Q where (R-Q)*(Q-P)/8 = 2.
Dickson's conjecture implies that if n == 0 or 1 (mod 3) there are infinitely many primes Q such that Q - 2 is the previous prime and Q + 4 n is the next prime, and that if n == 2 (mod 3) there are infinitely many primes Q such that Q - 2 is the previous prime and Q + 4 n + 2 is the next prime. - Robert Israel, Sep 24 2024

Crossrefs

Programs

  • Maple
    N:= 50: # for a(1) .. a(N)
    V:= Vector(N): count:= 0:
    q:= 2: r:= 3:
    while count < N do
      p:= q; q:= r; r:= nextprime(r);
      v:= floor((r-q)*(q-p)/8);
      if v >= 1 and v <= N and V[v] = 0 then
        V[v]:= q; count:= count+1
      fi;
    od:
    convert(V,list); # Robert Israel, Sep 24 2024
  • Mathematica
    With[{p = Prime[Range[10^6]]}, r = (Floor[(#[[3]] - #[[2]])*(#[[2]] - #[[1]])/8]) & /@ Partition[p, 3, 1]; p[[1 + TakeWhile[FirstPosition[r, #] & /@ Range[Max[r]], ! MissingQ[#] &] // Flatten]]] (* Amiram Eldar, Sep 24 2024 *)
  • PARI
    lista(len) = {my(c = 0, v = vector(len), p1 = 2, p2 = 3, i); forprime(p3 = 5, , i = floor((p3-p2)*(p2-p1)/8); if(i > 0 && i <= len && v[i] == 0, c++; v[i] = p2; if(c==len, break)); p1 = p2; p2 = p3); v;} \\ Amiram Eldar, Sep 24 2024
    
  • Python
    from sympy import nextprime
    def A375009(n):
        p,q = 2,3
        while True:
            r = nextprime(q)
            if (r-q)*(q-p)>>3==n:
                return q
            p,q = q,r # Chai Wah Wu, Oct 21 2024

A360968 Permutation of the positive integers derived through a process of self-reference and self-editing. a(1) = 1. Other terms generated as described in Comments.

Original entry on oeis.org

1, 3, 2, 7, 4, 13, 5, 12, 22, 15, 23, 8, 6, 36, 10, 31, 40, 26, 25, 56, 16, 9, 11, 55, 19, 18, 67, 54, 28, 86, 21, 48, 42, 45, 90, 14, 20, 37, 106, 17, 95, 33, 71, 130, 34, 27, 41, 32, 91, 47, 141, 66, 73, 29, 24, 38, 94, 164, 76, 155, 57, 133, 193, 98, 92
Offset: 1

Author

Carl R. White, Feb 27 2023

Keywords

Comments

Start with all terms set to the nominal value a(n) = n.
Mark all a(n), n > 1 as "unedited", and set a pointer p = 1.
For each unedited a(n), in increasing order of n, let q = n + a(p). Look at a(q). If a(q) has previously been edited, set a(n) = a(q); otherwise, set a(n) = q. In either case, then set a(q) = n. Mark both a(n) and a(q) as "edited". Increase p by 1 and move to the next unedited a(n), etc.
Note that once the process reaches any particular unedited n, sequence terms a(1) to a(n-1) will not be edited further by the generation process and are thus fixed. Terms of the sequence for entries greater than n may have been edited, but are "in flux" and may change again until n reaches them. p necessarily lags behind n, and so any a(p) is always well fixed by the time it is needed.
In many cases the generation process merely swaps two values relative to the positive integers, but since some edited terms could be re-edited, this will cause cycles to occur.
The positions of integers in this sequence would appear to be very hard to predict without actually generating the sequence.

Examples

			When n = 2, p = 1, so q := n+a(p) = 2+a(1) = 2+1 = 3. a(3) is "unedited" so a(n) = q and a(q) = n, i.e., set a(2) = 3 and a(3) = 2.
Since a(3) was edited by this, we continue at a(4), increasing p to 2.
Now, q := n+a(p) = 4+a(2) = 4+3 = 7. a(7) is unedited, so apply a(n) = q and a(q) = n again. i.e., set a(4) = 7 and a(7) = 4
a(5) was not edited previously, so we continue there, increasing p to 3.
Next, q := n+a(p) = 5 + a(3) = 5 + 2 = 7. a(7) is a previously edited term, so rather than use a(7)'s nominal value of 7, we instead use its currently held value of 4. I.e., a(n) = a(q) and, as always, a(q) = n. Thus we set a(5) = 4 and a(7) = 5. This must be done in the right order, lest both a(n) and a(q) be set to the same value (5 in this case).
At this point, note that while 2 and 3 are swapped relative to the positive integers, 4, 5, and 7 form a 3-cycle through their respective indices.
Continuing: a(6) is not yet edited, so n := 6 and p increases to 4. a(p) = 7, so we look to a(6+7) = a(13), an unedited term, so set a(6) = 13 and a(13) = 6, etc.
It so happens that a(13) is not edited again and remains 6, but in general it is theoretically possible that an edited term a(k) may be re-edited as long as n < k.
		

Crossrefs

Inspired loosely by A005185.
Cf. A236854, which is also self-altering in generation.

Programs

  • Python
    def A360968_list(maxn):
        B,C,p,n = [1],[],1,1
        while n < maxn:
            for i in range(2*n): B.append(0)
            n = B.index(0)+1
            q = n + B[p-1]
            if B[q-1] < 1: B[n-1] = q
            else: B[n-1] = B[q-1]
            B[q-1] = n
            p += 1
        for i in range(0,len(B)):
            if B[i]>0 and i+1 <= maxn:
                C.append(B[i])
        return C # John Tyler Rascoe, Mar 04 2023

A227864 Smallest base in which n's digital reversal is prime, or 0 if no such base exists.

Original entry on oeis.org

0, 0, 3, 2, 0, 2, 2, 2, 4, 6, 2, 2, 2, 2, 2, 3, 8, 2, 3, 3, 2, 3, 2, 2, 2, 2, 2, 9, 2, 2, 6, 2, 4, 3, 2, 3, 12, 2, 6, 3, 2, 2, 6, 2, 2, 3, 2, 2, 2, 3, 2, 9, 2, 2, 3, 2, 2, 3, 2, 4, 12, 2, 2, 3, 12, 3, 6, 2, 2, 3, 10, 2, 6, 2, 2, 3, 10, 2, 26, 3, 2, 27, 2, 2
Offset: 0

Author

Carl R. White, Nov 01 2013

Keywords

Comments

0 and 1 are not prime and are single digits in all bases, so no reversal of digits can make them prime. a(n) is therefore 0 for both.
4 is not prime and so cannot be prime if reversed in any base where it is a single digit. This leaves bases 2 and 3 where, upon reversal, it is 1 and 4 respectively. Neither are prime, and so a(4) is also 0.
Conjecture 1: 0, 1 and 4 are the only values where there is no base in which a digital reversal makes a prime.
It is clear that for any prime p, a(p) cannot be zero, since a(p)=p+1 is a solution if there is none smaller.
Conjecture 2: n = 2 is the only prime p which must be represented in base p+1, i.e., trivially, as a single digit, in order for its reversal to be prime.
Corollary: Since a(n) cannot be n itself -- reversing n in base n obtains 1, which is not prime -- this would mean that for all positive n except 2, a(n) < n.
Other than its small magnitude, a(n) = 2 occurs often due to the fact that a reversed positive binary number is guaranteed to be odd and thus stands a greater chance of being prime.
Similarly, many solutions exist solely because reversal removes all powers of the base from n, reducing the number of divisors. Thus based solely on observation:
Conjecture 3: With the restriction gcd(base,n) = 1, a(n) = 0 except for n = 2, 3 and 6k+-1, for positive integer k, i.e., terms of A038179.

Examples

			9 in base 2 is 1001, which when reversed is the same and so not prime. In base 3 it is 100, which becomes 1 when reversed and also not prime. Base 4: 21 -> 12 (6 decimal), not prime; Base 5: 14 -> 41 (21 decimal), not prime; Base 6: 13 -> 31 (19 decimal), which is prime, so a(9) = 6, i.e., 6 is the smallest base in which 9's digital reversal is a prime number.
		

Crossrefs

Positions of 2's: A204232.

Programs

  • Python
    from sympy import isprime
    from sympy.ntheory.digits import digits
    def okb(n, b):
        return isprime(sum(d*b**i for i, d in enumerate(digits(n, b)[1:])))
    def a(n):
        for b in range(2, n+2):
            if okb(n, b): return b
        return 0
    print([a(n) for n in range(84)]) # Michael S. Branicky, Sep 06 2021

A229897 Alternative version of A229874 with tuple values in increasing order.

Original entry on oeis.org

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

Author

Carl R. White, Oct 04 2013

Keywords

Comments

An enumeration of all sorted k-tuples containing positive integers.
Begin with the 1-tuple (1), and then reading from the beginning of the list of k-tuples append to the list (n+1) if the k-tuple read is a 1-tuple and for all cases, append the (k+1)-tuples (1,n,...), (2,n,...), ..., (n,n,...), where n is the first element of the k-tuple that was read.
This sequence is a flattening of that process.
Other properties of this sequence are as A229874.

Examples

			Sequence begins (1), (2), (1,1), (3), (1,2), (2,2), (1,1,1), (4), etc.
		

Crossrefs

Cf. A001057. All tuples, not just sorted: A229873. Alternative version: A229874

A229896 Sizes of logical groups of the same integer in A229895.

Original entry on oeis.org

1, 1, 4, 1, 5, 27, 1, 7, 37, 256, 1, 9, 61, 369, 3125, 1, 11, 91, 671, 4651, 46656, 1, 13, 127, 1105, 9031, 70993, 823543, 1, 15, 169, 1695, 15961, 144495, 1273609, 16777216, 1, 17, 217, 2465, 26281, 269297, 2685817, 26269505, 387420489, 1, 19, 271, 3439
Offset: 1

Author

Carl R. White, Oct 03 2013

Keywords

Comments

The two ones at the start of the parent sequence represent parent and child 1-tuples in the grandparent sequence [(1) and (2) respectively], hence this sequence also starts with 1, 1 rather than 2, which would otherwise be a more sensible way to describe the pair of ones.
All other elements are effectively run-lengths of strings of the same integer in A229895.
The first occurrence of an integer, n, in the parent sequence, is the first of a run of n^n elements of value n. For later occurrences, the run length is n^k-(n-1)^k where k is the size of the k-tuple in the grandparent sequence, A229873.
The elements can be arranged into a triangle thus:
.... 1
.... 1, 4
.... 1, 5, 27
.... 1, 7, 37, 256
.... 1, 9, 61, 369, 3125
.... etc.
where the n-th line is:
.... n^1-(n-1)^1, n^2-(n-1)^2, ..., n^(k-1)-(n-1)^(k-1), n^n; 1 <= k < n
The first terms, for sufficiently large n simplifying as:
.... 1, 2n-1, 3n^2-3n+1, 4n^3-6n^2+4n-1, etc.
Row sums are first differences of A031972, and thus the cumulative sum of rows at the end of each row is A031972 itself, i.e., n*(n^n - 1)/(n-1).

Crossrefs

Programs

  • Maple
    T := proc (n, k) if k < n then n^k-(n-1)^k elif k = n then n^n else end if end proc: for n to 12 do seq(T(n, k), k = 1 .. n) end do; # yields sequence in triangular form - Emeric Deutsch, Jan 30 2017
  • bc
    /* GNU bc */ for(n=1;n<=10;n++)for(p=1;p<=n;p++){if(p==n){t=n^n}else{t=n^p-(n-1)^p};print t,","};print "...\n"

A229895 k-tuple sizes in A229873.

Original entry on oeis.org

1, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4
Offset: 1

Author

Carl R. White, Oct 03 2013

Keywords

Comments

Number k of elements to read from A229873 to obtain the next k-tuple.

Examples

			The sequence of tuples represented in A229873 begins (1), (2), (1,1), (1,2), (2,1), (2,2), (3), so this sequence begins 1, 1, 2, 2, 2, 2, 1.
		

Crossrefs

Programs

  • bc
    /* GNU bc */ for(n=1;n<=5;n++)for(k=1;k<=n;k++){if(k==n){t=n^n}else{t=n^k-(n-1)^k};for(i=1;i<=t;i++) print k,","};print "...\n"

A229873 An enumeration of all k-tuples containing positive integers.

Original entry on oeis.org

1, 2, 1, 1, 1, 2, 2, 1, 2, 2, 3, 1, 3, 2, 3, 3, 1, 3, 2, 3, 3, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 2, 1, 1, 2, 2, 1, 2, 3, 2, 1, 1, 2, 1, 2, 2, 1, 3, 2, 2, 1, 2, 2, 2, 2, 2, 3, 3, 1, 1, 3, 1, 2, 3, 1, 3, 3, 2, 1, 3, 2, 2, 3, 2, 3, 3, 3, 1, 3, 3, 2, 3, 3, 3, 4
Offset: 1

Author

Carl R. White, Oct 01 2013

Keywords

Comments

The sequence pattern is an integer, n, followed by all k-tuples containing n, then (k+1)-tuples, etc., up to the n-tuples that have not yet appeared in the sequence. Directly before the integer n+1, therefore, we find the first occurrence of n^n n-tuples which contain the n^n permutations of 1 to n in lexicographic order. The cases n = 1 and n = 2 are degenerate as no tuples precede them; 1 is followed not by a tuple, but by 2, and 2 is followed by the tuple (1, 1), rather than (1, n) as with all other integers.
k-tuple clusters later in the sequence (k
Essentially, at each stage an n-hypercube of elements of size n is completed for each dimension up to the (n-1)-th, building on previous occurrences of the dimension, and then a hypercube for dimension n is begun to be built upon later.
Tuple sizes are in A229895.

Examples

			Sequence starts (1), (2), (1,1), (1,2), (2,1), (2,2), (3), (1,3), (2,3), (3,1), (3,2), (3,3), (1,1,1), ..., (3,3,3), (4), (1,4), etc.
		

Crossrefs

Cf. A001057. Sorted tuples only: A229874. Tuple sizes: A229895.

A229874 An enumeration of all sorted k-tuples containing positive integers.

Original entry on oeis.org

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

Author

Carl R. White, Oct 02 2013

Keywords

Comments

Begin with the 1-tuple (1), and then reading from the beginning of the list of k-tuples append to the list (n+1) if the k-tuple read is a 1-tuple and for all cases, append the (k+1)-tuples (...,n,1), (...,n,2), ..., (...,n,n), where n is the last element of the k-tuple that was read.
This sequence is a flattening of that process.
Each tuple contains a unique group of integers, meaning that the sequence of tuples is an enumeration of all finite sets of positive integers.
Determining a tuple's parent is as simple as removing the last element in the case of k-tuples where k>2 and by subtracting 1 from the only element in the case of 1-tuples. E.g., (7,5,3,2,1)'s ancestry is (7,5,3,2), (7,5,3), (7,5), (7), (6), (5), (4), (3), (2), (1).
Tuples are in ordered so that the rightmost element increases in value from sibling to sibling, resembling place-value notation. This has the side effect of putting the values within the tuples in the reverse of the usual sort order. The alternative version of this sequence with tuple values in increasing order can be found in A229897.
Remarkably, the k-tuple sizes can be found in A124736 - k repeated C(n,k-1) times - and relatedly, the first appearance of n in this sequence is at position 2^(n-1)+1.

Examples

			Sequence begins (1), (2), (1,1), (3), (2,1), (2,2), (1,1,1), (4), etc.
		

Crossrefs

Cf. A001057. All tuples, not just sorted: A229873. Alternative version: A229897.

A219960 Numbers which do not reach zero under the repeated iteration x -> ceiling(sqrt(x)) * (ceiling(sqrt(x))^2 - x).

Original entry on oeis.org

366, 680, 691, 1026, 1136, 1298, 1323, 1417, 1464, 1583, 1604, 1702, 2079, 2125, 2222, 2223, 2374, 2507, 2604, 2627, 2821, 2844, 2897, 3152, 3157, 3159, 3183, 3210, 3231, 3459, 3697, 3715, 3762, 3802, 3866, 3888, 3936, 3948, 4004, 4111, 4133, 4145, 4231, 4299
Offset: 1

Author

Carl R. White, Dec 02 2012

Keywords

Comments

Ceiling equivalent of A219303, with somewhat different behavior despite a near-identical iterative process.
Conjecture #1: All numbers under the iteration reach 0 or, like the elements of this sequence, reach a finite loop, and none expand indefinitely to infinity.
Conjecture #2: There are an infinite number of such finite loops, though there is often significant distance between them.
Conjecture #3: There are an infinite number of pairs of consecutive integers in this sequence despite being less abundant than in A219303.

Examples

			1702 is in this list as 38 iterations return to 1702. Many other numbers reach this loop. 5832 is also in this list and is the smallest member of a different loop.
1703 is _not_ in this list because the iteration runs: 1703 -> 2562 -> 1989 -> 1620 -> 2501 -> 5100 -> 6048 -> 2808 -> 53 -> 88 -> 120 -> 11 -> 20 -> 25 -> 0.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Ceiling[Sqrt[n]]*(Ceiling[Sqrt[n]]^2 - n); Select[Range[5000], NestWhileList[f, #, UnsameQ, All][[-1]] > 0 &] (* T. D. Noe, Dec 04 2012 *)

A219962 Records in A219961.

Original entry on oeis.org

314, 335, 337, 535, 539, 615, 666
Offset: 1

Author

Carl R. White, Dec 02 2012

Keywords

Comments

The first member of this sequence is currently (Dec 02 2012) one greater than the largest member yet found of cousin sequence A219553. Therein the value of 313 required significant time to determine. This is almost surely a coincidence, though it would be very interesting if it were not.
666 found at x = 72231492 under the iteration of A219960. No more entries up to x = 100400000

Crossrefs

Extensions

More terms from Carl R. White, Dec 05 2012