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.

A060288 Distinct (non-overlapping) twin Harshad numbers whose sum is prime.

Original entry on oeis.org

3, 7, 11, 19, 41, 401, 419, 449, 881, 1021, 1259, 1289, 1471, 1601, 1607, 1871, 1999, 2029, 2281, 2549, 2609, 2833, 3041, 3359, 3457, 4001, 4049, 4481, 4801, 5641, 6329, 7499, 7561, 8081, 8849, 8929, 9613, 9619, 10321, 11131, 12401, 12799, 13033
Offset: 1

Views

Author

Enoch Haga, Mar 23 2001

Keywords

Comments

Suggested by Puzzle 129, The Prime Puzzles and Problems Connection.

Examples

			a(3)=19, a prime, because the first Harshad number is 9 and the second is 10 and 9+10=19. To find the Harshad numbers take H1=(p-1)/2 as the first Harshad and then the second Harshad, H2=H1+1. Harshad numbers are those which have integral quotients after division by the sum of their digits. Note that 2+3=5 is not included because 1+2=3 are the first twins whose sum is prime and the next twins, 3+4=7, must not overlap the preceding pair.
		

Crossrefs

Programs

  • Mathematica
    harshadQ[n_] := Divisible[n, Plus @@ IntegerDigits[n]]; s = {}; q1 = True; Do[q2 = harshadQ[n]; If[q1 && q2, If[PrimeQ[2*n - 1], AppendTo[s, 2*n - 1]]; q1 = False, q1 = q2], {n, 2, 5000}]; s (* Amiram Eldar, Jan 19 2021 *)
  • UBASIC
    20 A=0; 30 inc A; 40 if Ct=2 then Z=(A-1)+(A-2): if Z=prmdiv(Z) then print A-2; "+"; A-1; "="; Z; "/"; :inc Pt; 50 if Ct=2 then Ct=1:A=A-1; 60 X=1; 70 B=str(A); 80 L=len(B); 90 inc X; 100 S=mid(B,X,1); 110 V=val(S):W=W+V; 120 if XDt+1 then Ct=0:Dt=0; 150 Dt=Ct:W=0; 160 if A<10000001 then 30; 170 print Pt;

Extensions

Offset corrected by Amiram Eldar, Jan 19 2021

A060290 Primes which are sums of twin Harshad numbers (includes overlaps).

Original entry on oeis.org

3, 5, 7, 11, 13, 17, 19, 41, 223, 401, 419, 449, 881, 1021, 1259, 1289, 1471, 1601, 1607, 1871, 1999, 2029, 2281, 2549, 2609, 2833, 3041, 3359, 3457, 4001, 4049, 4481, 4801, 4931, 5641, 6329, 7499, 7561, 8081, 8849, 8929, 9613, 9619, 10111, 10321
Offset: 1

Views

Author

Enoch Haga, Mar 24 2001

Keywords

Examples

			a(5)=17, a prime because the first Harshad number is 8 and the second is 9 and 8+9=17. In this sequence overlapping Harshad's are permitted: 1+2=3 and 2+3=5.
		

Crossrefs

Programs

  • Maple
    isA005349 := proc(n)
        if n mod digsum(n) = 0 then
            true;
        else
            false;
        end if;
    end proc:
    isA060290 := proc(n)
        local h1 ;
        if isprime(n) then
            h1 := (n-1)/2 ;
            if isA005349(h1) and isA005349(h1+1) then
                true;
            else
                false;
            end if;
        else
            false;
        end if;
    end proc:
    for n from 3 to 20000 do
        if isA060290(n) then
            printf("%d,",n) ;
        end if;
    end do: # R. J. Mathar, Dec 20 2013
  • Mathematica
    harshadQ[n_] := Divisible[n, Plus @@ IntegerDigits[n]]; s = {}; q1 = True; Do[q2 = harshadQ[n]; If[q1 && q2 && PrimeQ[2*n - 1], AppendTo[s, 2*n - 1]]; q1 = q2, {n, 2, 5000}]; s (* Amiram Eldar, Jan 19 2021 *)
  • UBASIC
    20 A=0;
    30 inc A;
    40 if Ct=2 then Z=(A-1)+(A-2): if Z=prmdiv(Z) then print A-2; "+"; A-1; "="; Z; "/"; :inc Pt;
    50 if Ct=2 then Ct=1:A=A-2;
    60 X=1;
    70 B=str(A);
    80 L=len(B);
    90 inc X;
    100 S=mid(B,X,1);
    110 V=val(S):W=W+V;
    120 if XDt+1 then Ct=0:Dt=0;
    150 Dt=Ct:W=0;
    160 if A<=10 then 30;
    170 print Pt;

Formula

{n in A000040: (n-1)/2 in A005349 and (n+1)/2 in A005349}. - R. J. Mathar, Dec 20 2013

Extensions

Offset corrected by Amiram Eldar, Jan 19 2021

A060291 Number of twin Harshads, including overlaps, whose sum is prime and where the 2nd Harshad is <= 10^n.

Original entry on oeis.org

7, 8, 21, 60, 278, 1520, 9583, 61835, 419705, 3023007, 22597508
Offset: 1

Views

Author

Enoch Haga, Mar 24 2001

Keywords

Examples

			a(1)=7 because there are 7 pairs of Harshads whose sum is prime and the 2nd Harshad in the pair is <= 10; these are 1+2=3, 2+3=5, 3+4=7, 5+6=11, 6+7=13, 8+9=17, 9+10=19. (Another sequence does not permit overlapping Harshad numbers.)
		

Crossrefs

Programs

  • Mathematica
    harshadQ[n_] := Divisible[n, Plus @@ IntegerDigits[n]]; c = 0; p = 10; s = {}; n = 0; k = 2; q1 = True; While[n < 6, q2 = harshadQ[k]; If[q1 && q2 && PrimeQ[2*k-1], c++; If[k > p, n++; AppendTo[s, c-1]; p *= 10]]; q1 = q2; k++]; s (* Amiram Eldar, Jan 19 2021 *)

Formula

Generate the twin Harshads whose sum is prime. Count how many there are where the 2nd Harshad in the pair is <= to a consecutive power of 10.

Extensions

a(8)-a(11) from Amiram Eldar, Jan 19 2021
Showing 1-3 of 3 results.