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: Karl-Heinz Hofmann

Karl-Heinz Hofmann's wiki page.

Karl-Heinz Hofmann has authored 78 sequences. Here are the ten most recent ones:

A385114 a(n) is the least k with k > a(n-1) such that A000120(k) = A002487(n), with a(0) = 0.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 9, 11, 16, 23, 25, 31, 33, 47, 49, 51, 64, 79, 83, 127, 131, 255, 271, 319, 320, 351, 355, 383, 385, 415, 417, 419, 512, 543, 551, 767, 771, 2047, 2111, 2559, 2561, 3071, 3135, 8191, 8207, 10239, 10271, 10367, 12288, 12415, 12431, 13311, 13315, 14335
Offset: 0

Author

Karl-Heinz Hofmann, Jun 18 2025

Keywords

Examples

			  n |  a(n)_2   a(n)   A002487(n)
----+-----------------------------
  0 |       0     0       0
  1 |       1     1       1
  2 |      10     2       1
  3 |      11     3       2
  4 |     100     4       1
  5 |     111     7       3
  6 |    1001     9       2
  7 |    1011    11       3
  8 |   10000    16       1
  9 |   10111    23       4
 10 |   11001    25       3
 11 |   11111    31       5
 12 |  100001    33       2
 13 |  101111    47       5
 14 |  110001    49       3
		

Crossrefs

Programs

  • Mathematica
    k = s[0] = 0; s[1] = 1; s[n_] := s[n] = If[EvenQ[n], s[n/2], s[(n - 1)/2] + s[(n + 1)/2]]; Array[s, 2^10]; {k}~Join~Monitor[Table[Set[k, Max[k + 1, 2^s[n] - 1]]; While[DigitCount[k, 2, 1] != s[n], k++]; k, {n, 100}], n] (* Michael De Vlieger, Jul 14 2025 *)
  • PARI
    lista(nn) = my(list = List([0]), last = 0); for (n=1, nn, my(k=last+1, d=dia(n)); while (hammingweight(k) != d, k++); last = k; listput(list, k);); Vec(list); \\ Michel Marcus, Jul 12 2025
    
  • Python
    # see links

Formula

a(A212288(n)) >= 2^A212289(n+1) - 1. - Hugo Pfoertner, Jul 15 2025

A384441 Binary XOR of n and the prime factors of n.

Original entry on oeis.org

1, 0, 0, 6, 0, 7, 0, 10, 10, 13, 0, 13, 0, 11, 9, 18, 0, 19, 0, 19, 17, 31, 0, 25, 28, 21, 24, 25, 0, 26, 0, 34, 41, 49, 33, 37, 0, 55, 41, 47, 0, 44, 0, 37, 43, 59, 0, 49, 54, 53, 33, 59, 0, 55, 57, 61, 41, 37, 0, 56, 0, 35, 59, 66, 73, 72, 0, 87, 81, 70, 0, 73, 0, 109
Offset: 1

Author

Karl-Heinz Hofmann, May 30 2025

Keywords

Examples

			For n = 12 the prime factors are {2,3} -> a(12) = 12 XOR 2 XOR 3 = 13.
a(13) = 13 XOR 13 = 0.
		

Crossrefs

Programs

  • Maple
    f:= l-> `if`(l=[], 0, Bits[Xor](l[1], f(l[2..-1]))):
    a:= n-> f([n, map(i-> i[1], ifactors(n)[2])[]]):
    seq(a(n), n=1..74);  # Alois P. Heinz, May 30 2025
  • Mathematica
    a[n_] := BitXor @@ Join[{n}, FactorInteger[n][[;; , 1]]]; a[1] = 1; Array[a, 100] (* Amiram Eldar, May 30 2025 *)
  • PARI
    a(n) = my(f=factor(n)[,1]); my(b=n); for (k=1, #f, b=bitxor(b, f[k])); b; \\ Michel Marcus, May 30 2025
  • Python
    from sympy import primefactors
    def A384441(n):
        result = n
        for pf in primefactors(n): result ^= pf
        return result
    

Formula

a(n) = XOR(n,A293212(n)).
a(n) = 0 <=> n is prime.
a(2^n) = A052548(n) for n>=2.

A383413 Area A of triangles such that the sides are distinct integers and A is an integer.

Original entry on oeis.org

6, 24, 30, 36, 42, 54, 60, 66, 72, 84, 90, 96, 114, 120, 126, 132, 144, 150, 156, 168, 180, 198, 204, 210, 216, 234, 240, 252, 264, 270, 288, 294, 300, 306, 324, 330, 336, 360, 378, 384, 390, 396, 408, 420, 456, 462, 468, 480, 486, 504, 510, 522, 528, 540, 546, 576, 594
Offset: 1

Author

Karl-Heinz Hofmann, Apr 26 2025

Keywords

Comments

All terms are multiples of 6.
Subsequence of A188158.

Examples

			72 is in the sequence because the triangle with sides {a=5, b=29, c=30} has an area of exactly 72 and all sides are distinct.
12 is not in the sequence because this area is only possible with the isosceles triangles {a=5, b=5, c=6} and {a=5, b=5, c=8} with a and b not distinct.
		

Crossrefs

Programs

  • Mathematica
    nn = 450; lst = {}; Do[s = (a + b + c)/2; If[IntegerQ[s], area2 = s (s - a) (s - b) (s - c); If[a!=b!=c&&0 < area2 <= nn^2 && IntegerQ[Sqrt[area2]], AppendTo[lst, Sqrt[area2]]]], {a, nn}, {b, a-1}, {c, b-1}]; Union[lst]; lst (* James C. McMahon, May 10 2025 *)

A382509 Integers s = (p1+p2)/4 such that p1 and p2 are consecutive primes and s can be written in the form p*2^k with k>=0 and p>2 prime.

Original entry on oeis.org

3, 6, 13, 17, 28, 38, 43, 67, 80, 88, 96, 118, 127, 137, 167, 178, 188, 193, 218, 223, 272, 283, 298, 302, 328, 368, 472, 487, 508, 563, 592, 613, 617, 634, 643, 647, 662, 718, 773, 778, 802, 808, 872, 878, 932, 1033, 1142, 1168, 1172, 1187, 1193, 1198, 1256, 1277
Offset: 1

Author

Keywords

Examples

			For n = 2: a(n) = 6 because 4 * 6 = 24 and 24 is the sum of the two consecutive primes 11 and 13 and the factorization of 6 is 3 * 2^1.
		

Crossrefs

Programs

  • Mathematica
    Select[Plus @@@ Partition[Prime[Range[400]], 2, 1]/4, IntegerQ[#] && PrimeQ[#/2^IntegerExponent[#, 2]] &] (* Amiram Eldar, Apr 21 2025 *)
  • PARI
    is(n) = my(v=valuation(n, 2), n2);if(!isprime(n>>v), return(0)); n2 = 2*n; n2 - precprime(n2) == nextprime(n2) - n2 \\ David A. Corneth, Apr 21 2025
  • Python
    from sympy import isprime, sieve as prime
    A382509 = []
    for x in range(2,1000):
        if (totest := (prime[x] + prime[x+1])) % 4 == 0:
            s = totest // 4
            while totest % 2 == 0: totest //= 2
            if isprime(totest): A382509.append(s)
    print(A382509)
    

A378719 Numbers k for which k/w = 3/4, where w is the number of numbers in the range {1..k} containing at least one decimal digit 1.

Original entry on oeis.org

19131872, 20809344, 20811488, 21257636, 22732948, 172186880, 1549681952, 2870345516, 2870345520, 2871907160, 2872143356, 2872251248, 13947137600, 125524238432, 496384984980, 516044091344, 530010360824, 530030555544, 530031618464, 530032461188, 530163415832, 530260860088
Offset: 1

Author

Keywords

Crossrefs

Programs

  • PARI
    \\ See link
    
  • Python
    # See link

A371000 a(n) are the records of the number of addends of the form j*(j+1)/2 (A000217) producing a sequence of consecutive composites starting at A370999(n).

Original entry on oeis.org

0, 1, 3, 6, 9, 12, 15, 21, 27, 33, 45, 87, 99, 102, 123, 156, 246, 273, 282, 330, 429, 465, 477, 561, 681, 891, 1050, 1206, 1338, 1443, 1449, 1479, 1656, 1701, 1836, 1899, 1941, 2151, 2199, 2280, 2301, 2517, 2592, 2595, 2709, 2724, 2751, 2760, 2934, 3045, 3240, 3333
Offset: 1

Author

Keywords

Comments

The "Ponder This Challenge" of March 2024 asked for the smallest start value of sequences of at least 1000 (or 2024 to gain the bonus) composite numbers in a progression defined by A000217.

Crossrefs

Programs

  • PARI
    a371000(upto) = {my(m=0); forcomposite (k=4, upto, for (j=1, oo, if (isprime(k+(j*(j+1))/2), if (j>m, print1(j-1, ", "); m=j); break)))};
    a371000(10^7)

A370999 Least composite number k such that the number m of consecutive composite sums k + j*(j+1)/2, j = 1, ..., m is a new maximum.

Original entry on oeis.org

4, 8, 9, 15, 24, 90, 105, 114, 225, 264, 300, 945, 5349, 7035, 11739, 17280, 35475, 46914, 190365, 351645, 603054, 1209900, 3146220, 3279864, 6407664, 26447649, 115192665, 408291345, 1080430119, 1298351109, 6459163344, 7731193299, 8096124894, 8884256514, 18927105834
Offset: 1

Author

Keywords

Comments

a(60) > 10^15.

Crossrefs

A371000 gives the corresponding counts m.

Extensions

a(43) in b-file corrected by Kebbaj Mohamed Reda, May 29 2024

A365933 a(n) is the period of the remainders when repdigits are divided by n.

Original entry on oeis.org

1, 9, 27, 9, 9, 27, 54, 9, 81, 9, 18, 27, 54, 54, 27, 9, 144, 81, 162, 9, 54, 18, 198, 27, 9, 54, 243, 54, 252, 27, 135, 9, 54, 144, 54, 81, 27, 162, 54, 9, 45, 54, 189, 18, 81, 198, 414, 27, 378, 9, 432, 54, 117, 243, 18, 54, 162, 252, 522, 27, 540, 135, 162, 9, 54
Offset: 1

Author

Karl-Heinz Hofmann, Nov 07 2023

Keywords

Comments

For n>1: Periods are divisible by 9 (= a full cycle in the sequence of repdigits). a(n)/9 is the period of the remainders when repunits are divided by n. So the digit part of the repdigits has no effect on periods generally. For most n the beginning of the periodic part is always A010785(1). If n is a term of A083118 the periodic part starts later after some initial remainders that do not repeat.

Examples

			For n = 6:                Remainders of A010785(1..54) mod n.
A010785( 1...9) mod n:      [1, 2, 3, 4, 5, 0, 1, 2, 3]
A010785(10..18) mod n:      [5, 4, 3, 2, 1, 0, 5, 4, 3]
A010785(19..27) mod n:      [3, 0, 3, 0, 3, 0, 3, 0, 3]
So the period is 3*9 = 27. Thus a(n) = 27. And the pattern seen above starts again:
A010785(28..36) mod n:      [1, 2, 3, 4, 5, 0, 1, 2, 3]
A010785(37..45) mod n:      [5, 4, 3, 2, 1, 0, 5, 4, 3]
A010785(46..54) mod n:      [3, 0, 3, 0, 3, 0, 3, 0, 3]
		

Crossrefs

Cf. A305322 (divisor 3), A002279 (divisor 5), A366596 (divisor 7).
Cf. A083118 (the impossible divisors).

Programs

  • Python
    def A365933(n):
        if n == 1: return 1
        remainders, exponent = [], 1
        while (rem:=(10**exponent // 9 % n)) not in remainders:
            remainders.append(rem); exponent += 1
        return (exponent - remainders.index(rem) - 1) * 9
    
  • Python
    def A365933(n):
        if n==1: return 1
        a,b,x,y=1,1,1%n,11%n
        while x!=y:
            if a==b:
                a<<=1
                x,b=y,0
            y = (10*y+1)%n
            b+=1
        return 9*b # Chai Wah Wu, Jan 23 2024

A365932 a(n) = the number of cubes (of integers > 0) that have bit length n.

Original entry on oeis.org

1, 0, 0, 1, 1, 0, 2, 1, 1, 3, 2, 3, 5, 5, 6, 9, 10, 13, 17, 21, 26, 34, 42, 52, 67, 84, 105, 134, 167, 211, 267, 335, 422, 533, 670, 845, 1065, 1341, 1690, 2130, 2682, 3380, 4259, 5365, 6760, 8518, 10730, 13520, 17035, 21461, 27040, 34069, 42923, 54080, 68137, 85847
Offset: 1

Author

Karl-Heinz Hofmann, Oct 05 2023

Keywords

Comments

Number of cubes in the range: 2^(n-1) <= k^3 < 2^n-1.
There is no need to include 2^n-1 because it is a Mersenne number and it cannot be a power anyway.

Examples

			For n = 13; a(n) = 5; following 5 cubes have a bit length of 13: 16^3, 17^3, 18^3, 19^3 and 20^3.
		

Crossrefs

Cf. A004632.
Cf. A017981 (partial sums).

Programs

  • Mathematica
    a[n_] := Floor[Surd[2^n-1, 3]] - Floor[Surd[2^(n-1)-1, 3]]; Array[a, 56] (* Amiram Eldar, Oct 30 2023 *)
  • Python
    from sympy import integer_nthroot
    def A365932(n):
        return integer_nthroot(2**n-1, 3)[0] - integer_nthroot(2**(n-1)-1, 3)[0]
    print([A365932(n) for n in range(1,57)])

Formula

a(n) = floor((2^n-1)^(1/3)) - floor((2^(n-1)-1)^(1/3)) for n > 0.
Limit_{n->oo} a(n)/a(n-1) = 2^(1/3) = A002580.

A365931 a(n) = number of pairs {x,y} with (x,y > 1) such that x^y (= terms of A072103) has bit length <= n.

Original entry on oeis.org

0, 0, 1, 3, 7, 10, 18, 25, 35, 50, 69, 94, 132, 178, 244, 334, 460, 629, 869, 1201, 1668, 2314, 3223, 4493, 6280, 8793, 12322, 17288, 24286, 34139, 48036, 67630, 95274, 134285, 189349, 267090, 376880, 531942, 750991, 1060463, 1497741, 2115669, 2988957, 4223225, 5967822, 8433889
Offset: 1

Author

Karl-Heinz Hofmann, Oct 07 2023

Keywords

Comments

Number of pairs {x,y} with (x,y > 1) for which x^y < 2^n-1.
In some special cases different pairs have the same result (see A072103 and the example here) and those multiple representations are counted separately.
There is no need to include 2^n-1 because it is a Mersenne number and it cannot be a power anyway.
Limit_{n->oo} a(n)/a(n-1) = sqrt(2) = A002193.
Partial sums of A365930.

Examples

			For n = 6: the Mersenne number 2^6-1 = 63 is the largest number with bit length 6 and the upper bound for the following a(6) = 10 powers: 2^2, 2^3, 2^4, 2^5, 3^2, 3^3, 4^2, 5^2, 6^2, 7^2.
		

Crossrefs

Cf. A072103, A002193, A365930 (first differences).
Cf. A017912 (squares), A017981 (cubes).

Programs

  • Mathematica
    a[n_] := Sum[Ceiling[2^(n/k)] - 2, {k, 2, n}]; Array[a, 47]
  • Python
    from sympy import integer_nthroot, integer_log
    def A365931(n):
        result, nMersenne, new = 0, (1<
    				

Formula

a(n) = Sum_{y = 2..n} (ceiling(2^(n/y)) - 2)
a(n) = Sum_{y = 2..n} (floor((2^n-1)^(1/y)) - 1)
a(n) = Sum_{k = 1..n} A365930(k).