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.

Previous Showing 21-28 of 28 results.

A236514 Primes with a binary weight greater than or equal to the binary weight of their squares.

Original entry on oeis.org

2, 3, 7, 23, 31, 47, 79, 127, 157, 191, 223, 317, 367, 379, 383, 479, 727, 751, 887, 1087, 1151, 1277, 1279, 1451, 1471, 1531, 1663, 1783, 1789, 1951, 2297, 2557, 2927, 3067, 3259, 3319, 3581, 3583, 3967, 4253, 4349, 5119, 5231, 5503, 5807, 5821, 6079, 6143, 6271, 6653, 6871, 6911, 7039, 7103, 7151
Offset: 1

Views

Author

Irina Gerasimova, Jan 27 2014

Keywords

Comments

Primes p such that A000120(p) = A000120(p^2): 2, 3, 7, 31, 79, 127, 157, 317, 379, 751, 1087, 1151, 1277, 1279,...

Examples

			2 is in this sequence because 2 is 10 in binary representation, and it has as many 1s as its square 4, which is 100 in binary.
		

Crossrefs

Programs

  • Mathematica
    bc[n_] := DigitCount[n, 2][[1]]; Select[Range[7151], PrimeQ[#] && bc[#] >= bc[#^2] &] (* Giovanni Resta, Jan 28 2014 *)
    Select[Prime[Range[1000]], DigitCount[#, 2, 1] >= DigitCount[#^2, 2, 1] &] (* Alonso del Arte, Jan 28 2014 *)
  • PARI
    is(n)=hammingweight(n^2)<=hammingweight(n) && isprime(n) \\ Charles R Greathouse IV, Mar 18 2014

Formula

Primes p such that A000120(p) >= A000120(p^2).

A352086 a(n) is the smallest positive integer k such that wt(k^2) / wt(k) = n where wt(k) = A000120(k) is the binary weight of k.

Original entry on oeis.org

1, 21, 2697, 4736533, 14244123157, 4804953862344753
Offset: 1

Views

Author

Bernard Schott, Mar 06 2022

Keywords

Comments

Theorem (proofs in Diophante link):
For any n and any base b, there exists m such that sod_b(m^2) / sod_b(m) = n, where sod_b(m) = sum of digits of m in base b (A280012 for base 10).
a(n) is odd. Proof: a(n) exists. Furthermore, if a(n) is even then wt(a(n)) = wt(a(n)/2) and wt(a(n)^2) = wt((a(n)/2)^2) so then a(n)/2 so that a(n)/2 is a lesser candidate, a contradiction. - David A. Corneth, Mar 06 2022

Examples

			We have 21_10 = 10101_2, so wt(21) = 3 ones; then 21^2 = 441_10 = 110111001_2, so wt(21^2) = 6 ones; as 6/3 = 2 and 21 is the smallest integer k such that wt(k^2) / wt(k) = 2, hence a(2) = 21.
		

Crossrefs

Programs

  • Mathematica
    r[n_] := Total[IntegerDigits[n^2, 2]]/Total[IntegerDigits[n, 2]]; seq[max_, nmax_] := Module[{s = Table[0, {max}], c = 0, n = 1, i}, While[c < max && n < nmax, i = r[n]; If[IntegerQ[i] && s[[i]] == 0, c++; s[[i]] = n]; n+=2]; TakeWhile[s, # > 0 &]]; seq[4, 5*10^6] (* Amiram Eldar, Mar 06 2022 *)
  • Python
    from gmpy2 import popcount
    aDict=dict()
    for k in range(1, 10**11, 2):
        if popcount(k*k)%popcount(k)==0:
            n=popcount(k*k)//popcount(k)
            if not n in aDict:
                print(n, k); aDict[n]=k # Martin Ehrenstein, Mar 16 2022

Formula

a(n) > 2^(n^2/2) for n > 1. - Charles R Greathouse IV, Mar 16 2022

Extensions

a(3)-a(5) from David A. Corneth, Mar 06 2022
a(6) -- using the Muła et al. Faster Population Counts algorithm -- from Martin Ehrenstein, Mar 15 2022

A261593 Odd numbers n such that the sum of the binary digits of n and n^2 both equal 12.

Original entry on oeis.org

4095, 10239, 11263, 12159, 12223, 12255, 12271, 12279, 12283, 14333, 15351, 15355, 15743, 15807, 18431, 19455, 19967, 20351, 20477, 22015, 22495, 22511, 24031, 24303, 24431, 24445, 25599, 26615, 26621, 27519, 27631, 27639, 28095, 28411, 28413, 28511, 28541, 28575
Offset: 1

Views

Author

Keywords

Comments

Hare, Laishram, & Stoll show that this sequence is infinite.
12 is the least constant for which the associated sequence is known to be infinite. 1 through 8 make finite sequences, the sequences with 9 and 10 are conjectured finite, and the sequence with 11 is unknown. (See Hare-Laishram-Stoll Theorem 1.3 and 1.4 plus section 5.)
Odd numbers n such that the sum of the binary digits of n-1 and n^2-1 both equal 11. - Chai Wah Wu, Aug 26 2015

Examples

			4095 = 111111111111_2 and 4095^2 = 111111111110000000000001_2 both have 12 1s in binary.
		

Crossrefs

Subsequence of A261586 and hence of A077436.

Programs

  • Mathematica
    Select[2 Range@ 15000 - 1, Total@ IntegerDigits[#, 2] == 12 && Total@ IntegerDigits[#^2, 2] == 12 &] (* Michael De Vlieger, Aug 27 2015 *)
  • PARI
    is(n)=n%2 && hammingweight(n)==12 && hammingweight(n^2)==12
    
  • PARI
    \\ List the elements below 2^(N+1).
    go(N)=my(v=List(),n); forvec(u=vector(11,i,[1,N-11+i]), n=sum(i=1,11,2^u[i])+1; if(hammingweight(n^2)==12, listput(v,n)), 2); Set(v)
    
  • Python
    from itertools import combinations
    A261593_list = []
    for c in combinations((2**x for x in range(15)),11):
        n = sum(c)
        if sum(int(d) for d in format(n*(n+1),'b')) == 11:
            A261593_list.append(2*n+1)
    A261593_list = sorted(A261593_list) # Chai Wah Wu, Aug 26 2015

A261640 Numbers n such that the digital sum of n is the same as the digital sum of n^2 in both base 2 and base 10.

Original entry on oeis.org

0, 1, 351, 379, 496, 558, 639, 1495, 1792, 3259, 4600, 5950, 6399, 6588, 8568, 10494, 10495, 12799, 17380, 17919, 26479, 38872, 38880, 44991, 44992, 46585, 48888, 56952, 59247, 60895, 64639, 89839, 89848, 89856, 92799, 105390, 142848, 168895, 174078, 179596
Offset: 1

Views

Author

Tom Edgar, Aug 27 2015

Keywords

Comments

Intersection of A077436 and A058369.
Numbers such that A007953(n) = A007953(n^2) and A000120(n) = A000120(n^2).

Examples

			Consider the number n = 351 so n^2 = 123201. The base-10 digit sums of 351 and 123201 are both 9. Moreover, 351 has binary representation 101011111 and 123201 has binary representation 11110000101000001 and both have base-2 digit sum = 7. Thus 351 is a term in the sequence.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[0,180000],Total[IntegerDigits[#]]==Total[IntegerDigits[#^2]]&&Total[ IntegerDigits[ #,2]]==Total[IntegerDigits[#^2,2]]&] (* Harvey P. Dale, May 29 2023 *)
  • Sage
    [n for n in [0..200000] if sum((n).digits(2))==sum((n^2).digits(2)) and sum((n).digits())==sum((n^2).digits())]

Extensions

Name (definition) and Example edited by Harvey P. Dale, May 29 2023

A265113 Primes p such that p and p^2 have the same number of 1's in their binary representations.

Original entry on oeis.org

2, 3, 7, 31, 79, 127, 157, 317, 379, 751, 1087, 1151, 1277, 1279, 1531, 1789, 1951, 2297, 2557, 2927, 3067, 3259, 3319, 3581, 4253, 4349, 5119, 5231, 5503, 5807, 5821, 6271, 6653, 6871, 8191, 8447, 8689, 9209, 10079, 10837, 11597, 11903, 12799, 13309, 13591
Offset: 1

Views

Author

Robert Israel, Dec 01 2015

Keywords

Comments

Primes p such that p^2 is in A089042.
Primes p such that A000120(p) = A000120(p^2).
Contains all terms > 43 in A079361.
Subset of A077436.

Examples

			7 is in the sequence because 7 and 7^2 = 49 have binary representations 111 and 110001 which both have three 1's.
		

Crossrefs

Programs

  • Magma
    [NthPrime(n): n in [1..2000] | Multiplicity({* z: z in Intseq(NthPrime(n)^2, 2) *}, 1) eq &+Intseq(NthPrime(n), 2)]; // Vincenzo Librandi, Dec 02 2015
    
  • Maple
    f:= proc(n) isprime(n) and (convert(convert(n,base,2),`+`) = convert(convert(n^2,base,2),`+`)) end proc:
    select(f, [2,seq(i,i=3..10^5,2)]);
  • Mathematica
    Select[ Prime@ Range@ 1700, DigitCount[n, 2, 1] == DigitCount[n^2, 2, 1],  &] (* Robert G. Wilson v, Dec 01 2015 *)
  • PARI
    c(k, d, b) = {my(c=0, f); while (k>b-1, f=k-b*(k\b); if (f==d, c++); k\=b); if (k==d, c++); return(c)}
    forprime(p=2, 1e5, if(c(p, 1, 2) == c(p^2, 1, 2), print1(p, ", "))) \\ Altug Alkan, Dec 02 2015

A340100 Fixed points of A340069.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 730, 1449, 4803, 8506, 10837, 17012, 18321, 21674, 43348, 86696, 103622, 103628, 153696, 173392, 185395, 207244, 227393, 370780, 454786, 693568, 936337, 989572, 1172353, 1284865, 1387136, 1413399, 1820929, 1872674, 2344706, 2569730, 2774272, 2826798
Offset: 1

Views

Author

Thomas Scheuerle, Dec 28 2020

Keywords

Comments

A subset of A077436 because A000120(a(n)) = A000120(a(n)^2).

Crossrefs

Formula

a(n) = A340069(a(n)).

Extensions

Incorrect terms removed and a(16)-a(33) added by Chai Wah Wu, Jan 08 2021
a(34)-a(38) from Chai Wah Wu, Jan 14 2021

A091819 Numbers k that have, in binary, the same number of ones as are in k^2 and which have no nonincreasing binary representation.

Original entry on oeis.org

79, 91, 157, 158, 159, 182, 183, 187, 279, 287, 314, 316, 317, 318, 319, 351, 364, 365, 366, 374, 375, 379, 445, 558, 573, 574, 575, 628, 632, 634, 636, 637, 638, 639, 702, 703, 728, 730, 732, 735, 748, 750, 751, 758, 759, 763, 815, 890, 893, 975, 1071
Offset: 1

Views

Author

Ralf Stephan, Mar 08 2004

Keywords

Comments

In A077436 but not in A023758.

A232245 Sum of the number of ones in binary representation of n and n^2.

Original entry on oeis.org

0, 2, 2, 4, 2, 5, 4, 6, 2, 5, 5, 8, 4, 7, 6, 8, 2, 5, 5, 8, 5, 9, 8, 7, 4, 8, 7, 10, 6, 9, 8, 10, 2, 5, 5, 8, 5, 9, 8, 11, 5, 8, 9, 11, 8, 12, 7, 9, 4, 8, 8, 9, 7, 12, 10, 12, 6, 10, 9, 12, 8, 11, 10, 12, 2, 5, 5, 8, 5, 9, 8, 11, 5, 9, 9, 13, 8, 11, 11, 10, 5, 9
Offset: 0

Views

Author

Jon Perry, Nov 20 2013

Keywords

Comments

The sequence is never 1 or 3, but seems to take on all other values. The fact it is never 3 can be used to prove if n^2 has exactly 4 1's then it must have an even number of 0's (A231898).

Examples

			5 is 101 and 25 is 11001, so a(5) = 2 + 3 = 5.
		

Crossrefs

Programs

  • JavaScript
    function bitCount(n) {
    var i,c,s;
    c=0;
    s=n.toString(2);
    for (i=0;i
    				

Formula

a(n) = A159918(n) + A000120(n).
Previous Showing 21-28 of 28 results.